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 "BuiltinDumper.h"
13 #include "ClassDefinitionDumper.h"
14 #include "EnumDumper.h"
15 #include "LinePrinter.h"
16 #include "llvm-pdbdump.h"
17 #include "TypedefDumper.h"
19 #include "llvm/DebugInfo/PDB/IPDBSession.h"
20 #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
21 #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
22 #include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
23 #include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
24 #include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
28 TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
30 void TypeDumper::start(const PDBSymbolExe &Exe) {
31 auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
33 WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums";
34 Printer << ": (" << Enums->getChildCount() << " items)";
36 while (auto Enum = Enums->getNext())
40 auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
42 WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs";
43 Printer << ": (" << Typedefs->getChildCount() << " items)";
45 while (auto Typedef = Typedefs->getNext())
49 auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
51 WithColor(Printer, PDB_ColorItem::Identifier).get() << "Classes";
52 Printer << ": (" << Classes->getChildCount() << " items)";
54 while (auto Class = Classes->getNext())
59 void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
60 if (Symbol.getUnmodifiedTypeId() != 0)
62 if (Printer.IsTypeExcluded(Symbol.getName()))
64 // Dump member enums when dumping their class definition.
65 if (Symbol.isNested())
69 EnumDumper Dumper(Printer);
73 void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
74 if (Printer.IsTypeExcluded(Symbol.getName()))
78 TypedefDumper Dumper(Printer);
82 void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
83 if (Symbol.getUnmodifiedTypeId() != 0)
85 if (Printer.IsTypeExcluded(Symbol.getName()))
90 if (opts::NoClassDefs) {
91 WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
92 WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
94 ClassDefinitionDumper Dumper(Printer);