llvm-pdbdump: Add more comprehensive dumping of symbol types.
[oota-llvm.git] / lib / DebugInfo / PDB / PDBSymbolTypePointer.cpp
1 //===- PDBSymbolTypePointer.cpp - --------------------------------*- C++
2 //-*-===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is distributed under the University of Illinois Open Source
7 // License. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 #include <utility>
12
13 #include "llvm/DebugInfo/PDB/IPDBSession.h"
14 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
15 #include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
16
17 using namespace llvm;
18
19 PDBSymbolTypePointer::PDBSymbolTypePointer(
20     const IPDBSession &PDBSession, std::unique_ptr<IPDBRawSymbol> Symbol)
21     : PDBSymbol(PDBSession, std::move(Symbol)) {}
22
23 void PDBSymbolTypePointer::dump(raw_ostream &OS, int Indent,
24                                 PDB_DumpLevel Level) const {
25   OS << stream_indent(Indent);
26   if (isConstType())
27     OS << "const ";
28   if (isVolatileType())
29     OS << "volatile ";
30   uint32_t PointeeId = getTypeId();
31   if (auto PointeeType = Session.getSymbolById(PointeeId))
32     PointeeType->dump(OS, 0, PDB_DumpLevel::Compact);
33   OS << ((isReference()) ? "&" : "*");
34 }