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 "LinePrinter.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/PDBSymbolTypeTypedef.h"
21 #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
25 TypeDumper::TypeDumper(LinePrinter &P, bool ClassDefs)
26 : PDBSymDumper(true), Printer(P), FullClassDefs(ClassDefs) {}
28 void TypeDumper::start(const PDBSymbolExe &Exe) {
29 auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
31 WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums";
32 Printer << ": (" << Enums->getChildCount() << " items)";
34 while (auto Enum = Enums->getNext())
38 auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
40 WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs";
41 Printer << ": (" << Typedefs->getChildCount() << " items)";
43 while (auto Typedef = Typedefs->getNext())
47 auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
49 WithColor(Printer, PDB_ColorItem::Identifier).get() << "Classes";
50 Printer << ": (" << Classes->getChildCount() << " items)";
52 while (auto Class = Classes->getNext())
57 void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
58 if (Symbol.getUnmodifiedTypeId() != 0)
60 if (Printer.IsTypeExcluded(Symbol.getName()))
64 WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
65 WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
68 void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
69 if (Printer.IsTypeExcluded(Symbol.getName()))
73 TypedefDumper Dumper(Printer);
77 void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
78 if (Symbol.getUnmodifiedTypeId() != 0)
80 if (Printer.IsTypeExcluded(Symbol.getName()))
86 ClassDefinitionDumper Dumper(Printer);
89 WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
90 WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();