X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=tools%2Fllvm-pdbdump%2FTypeDumper.cpp;h=88c0bd65697ede96444d642076599aa037ee1550;hb=20a42bb20d43b80e322c95dd99b64a5a4566fe08;hp=72171b0f318808a3095275f2750a34b9ba232469;hpb=395adf9f891cdbe5aa58d0817c06a27880894eb4;p=oota-llvm.git diff --git a/tools/llvm-pdbdump/TypeDumper.cpp b/tools/llvm-pdbdump/TypeDumper.cpp index 72171b0f318..88c0bd65697 100644 --- a/tools/llvm-pdbdump/TypeDumper.cpp +++ b/tools/llvm-pdbdump/TypeDumper.cpp @@ -9,55 +9,89 @@ #include "TypeDumper.h" -#include "FunctionDumper.h" +#include "BuiltinDumper.h" +#include "ClassDefinitionDumper.h" +#include "EnumDumper.h" +#include "LinePrinter.h" #include "llvm-pdbdump.h" #include "TypedefDumper.h" #include "llvm/DebugInfo/PDB/IPDBSession.h" #include "llvm/DebugInfo/PDB/PDBSymbolExe.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h" #include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h" -#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h" #include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h" using namespace llvm; -TypeDumper::TypeDumper() : PDBSymDumper(true) {} +TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {} -void TypeDumper::start(const PDBSymbolExe &Exe, raw_ostream &OS, int Indent) { +void TypeDumper::start(const PDBSymbolExe &Exe) { auto Enums = Exe.findAllChildren(); - OS << newline(Indent) << "Enums: (" << Enums->getChildCount() << " items)"; + Printer.NewLine(); + WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums"; + Printer << ": (" << Enums->getChildCount() << " items)"; + Printer.Indent(); while (auto Enum = Enums->getNext()) - Enum->dump(OS, Indent + 2, *this); - - auto FuncSigs = Exe.findAllChildren(); - OS << newline(Indent); - OS << "Function Signatures: (" << FuncSigs->getChildCount() << " items)"; - while (auto Sig = FuncSigs->getNext()) - Sig->dump(OS, Indent + 2, *this); + Enum->dump(*this); + Printer.Unindent(); auto Typedefs = Exe.findAllChildren(); - OS << newline(Indent) << "Typedefs: (" << Typedefs->getChildCount() - << " items)"; + Printer.NewLine(); + WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs"; + Printer << ": (" << Typedefs->getChildCount() << " items)"; + Printer.Indent(); while (auto Typedef = Typedefs->getNext()) - Typedef->dump(OS, Indent + 2, *this); + Typedef->dump(*this); + Printer.Unindent(); + + auto Classes = Exe.findAllChildren(); + Printer.NewLine(); + WithColor(Printer, PDB_ColorItem::Identifier).get() << "Classes"; + Printer << ": (" << Classes->getChildCount() << " items)"; + Printer.Indent(); + while (auto Class = Classes->getNext()) + Class->dump(*this); + Printer.Unindent(); } -void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol, raw_ostream &OS, - int Indent) { - OS << newline(Indent) << "enum " << Symbol.getName(); +void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) { + if (Symbol.getUnmodifiedTypeId() != 0) + return; + if (Printer.IsTypeExcluded(Symbol.getName())) + return; + // Dump member enums when dumping their class definition. + if (Symbol.isNested()) + return; + + Printer.NewLine(); + EnumDumper Dumper(Printer); + Dumper.start(Symbol); } -void TypeDumper::dump(const PDBSymbolTypeFunctionSig &Symbol, raw_ostream &OS, - int Indent) { - OS << newline(Indent); - FunctionDumper Dumper; - Dumper.start(Symbol, FunctionDumper::PointerType::None, OS); +void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) { + if (Printer.IsTypeExcluded(Symbol.getName())) + return; + + Printer.NewLine(); + TypedefDumper Dumper(Printer); + Dumper.start(Symbol); } -void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol, raw_ostream &OS, - int Indent) { - OS << newline(Indent); - TypedefDumper Dumper; - Dumper.start(Symbol, OS, Indent); - OS.flush(); +void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) { + if (Symbol.getUnmodifiedTypeId() != 0) + return; + if (Printer.IsTypeExcluded(Symbol.getName())) + return; + + Printer.NewLine(); + + if (opts::NoClassDefs) { + WithColor(Printer, PDB_ColorItem::Keyword).get() << "class "; + WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName(); + } else { + ClassDefinitionDumper Dumper(Printer); + Dumper.start(Symbol); + } }