1 //===- TypeDumper.cpp - PDBSymDumper implementation for types *----- C++ *-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "TypeDumper.h"
12 #include "ClassDefinitionDumper.h"
13 #include "FunctionDumper.h"
14 #include "llvm-pdbdump.h"
15 #include "TypedefDumper.h"
17 #include "llvm/DebugInfo/PDB/IPDBSession.h"
18 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
19 #include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
20 #include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
21 #include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
22 #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
26 TypeDumper::TypeDumper(bool Inline, bool ClassDefs)
27 : PDBSymDumper(true), InlineDump(Inline), FullClassDefs(ClassDefs) {}
29 void TypeDumper::start(const PDBSymbolExe &Exe, raw_ostream &OS, int Indent) {
30 auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
31 OS << newline(Indent) << "Enums: (" << Enums->getChildCount() << " items)";
32 while (auto Enum = Enums->getNext())
33 Enum->dump(OS, Indent + 2, *this);
35 auto FuncSigs = Exe.findAllChildren<PDBSymbolTypeFunctionSig>();
36 OS << newline(Indent);
37 OS << "Function Signatures: (" << FuncSigs->getChildCount() << " items)";
38 while (auto Sig = FuncSigs->getNext())
39 Sig->dump(OS, Indent + 2, *this);
41 auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
42 OS << newline(Indent) << "Typedefs: (" << Typedefs->getChildCount()
44 while (auto Typedef = Typedefs->getNext())
45 Typedef->dump(OS, Indent + 2, *this);
47 auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
48 OS << newline(Indent) << "Classes: (" << Classes->getChildCount()
50 while (auto Class = Classes->getNext())
51 Class->dump(OS, Indent + 2, *this);
54 void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS,
56 if (Symbol.getUnmodifiedTypeId() != 0)
60 OS << newline(Indent);
62 OS << "enum " << Symbol.getName();
65 void TypeDumper::dump(const PDBSymbolTypeFunctionSig &Symbol, raw_ostream &OS,
68 OS << newline(Indent);
70 FunctionDumper Dumper;
71 Dumper.start(Symbol, FunctionDumper::PointerType::None, OS);
74 void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS,
77 OS << newline(Indent);
80 Dumper.start(Symbol, OS, Indent);
83 void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol, raw_ostream &OS,
85 if (Symbol.getUnmodifiedTypeId() != 0)
88 OS << newline(Indent);
91 ClassDefinitionDumper Dumper;
92 Dumper.start(Symbol, OS, Indent);
94 OS << "class " << Symbol.getName();