2015-02-22 22:03:38 +00:00
|
|
|
//===- TypeDumper.cpp - PDBSymDumper implementation for types *----- C++ *-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "TypeDumper.h"
|
|
|
|
|
2015-03-04 06:09:53 +00:00
|
|
|
#include "BuiltinDumper.h"
|
2015-02-23 05:58:34 +00:00
|
|
|
#include "ClassDefinitionDumper.h"
|
2015-03-04 06:09:53 +00:00
|
|
|
#include "EnumDumper.h"
|
2015-02-27 09:15:59 +00:00
|
|
|
#include "LinePrinter.h"
|
2015-02-22 22:03:38 +00:00
|
|
|
#include "llvm-pdbdump.h"
|
|
|
|
#include "TypedefDumper.h"
|
|
|
|
|
|
|
|
#include "llvm/DebugInfo/PDB/IPDBSession.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
|
2015-03-04 06:09:53 +00:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
|
2015-02-22 22:03:38 +00:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
|
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
|
2015-02-23 05:58:34 +00:00
|
|
|
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
|
2015-02-22 22:03:38 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2015-03-04 06:09:53 +00:00
|
|
|
TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
|
2015-02-22 22:03:38 +00:00
|
|
|
|
2015-03-01 06:51:29 +00:00
|
|
|
void TypeDumper::start(const PDBSymbolExe &Exe) {
|
2015-02-22 22:03:38 +00:00
|
|
|
auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
|
2015-02-27 09:15:59 +00:00
|
|
|
Printer.NewLine();
|
|
|
|
WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums";
|
|
|
|
Printer << ": (" << Enums->getChildCount() << " items)";
|
|
|
|
Printer.Indent();
|
2015-02-22 22:03:38 +00:00
|
|
|
while (auto Enum = Enums->getNext())
|
2015-03-01 06:51:29 +00:00
|
|
|
Enum->dump(*this);
|
2015-02-27 09:15:59 +00:00
|
|
|
Printer.Unindent();
|
2015-02-22 22:03:38 +00:00
|
|
|
|
|
|
|
auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
|
2015-02-27 09:15:59 +00:00
|
|
|
Printer.NewLine();
|
|
|
|
WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs";
|
|
|
|
Printer << ": (" << Typedefs->getChildCount() << " items)";
|
|
|
|
Printer.Indent();
|
2015-02-22 22:03:38 +00:00
|
|
|
while (auto Typedef = Typedefs->getNext())
|
2015-03-01 06:51:29 +00:00
|
|
|
Typedef->dump(*this);
|
2015-02-27 09:15:59 +00:00
|
|
|
Printer.Unindent();
|
2015-02-23 05:58:34 +00:00
|
|
|
|
|
|
|
auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
|
2015-02-27 09:15:59 +00:00
|
|
|
Printer.NewLine();
|
|
|
|
WithColor(Printer, PDB_ColorItem::Identifier).get() << "Classes";
|
|
|
|
Printer << ": (" << Classes->getChildCount() << " items)";
|
|
|
|
Printer.Indent();
|
2015-02-23 05:58:34 +00:00
|
|
|
while (auto Class = Classes->getNext())
|
2015-03-01 06:51:29 +00:00
|
|
|
Class->dump(*this);
|
2015-02-27 09:15:59 +00:00
|
|
|
Printer.Unindent();
|
2015-02-22 22:03:38 +00:00
|
|
|
}
|
|
|
|
|
2015-03-01 06:51:29 +00:00
|
|
|
void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
|
2015-02-23 05:58:34 +00:00
|
|
|
if (Symbol.getUnmodifiedTypeId() != 0)
|
|
|
|
return;
|
2015-03-01 06:49:49 +00:00
|
|
|
if (Printer.IsTypeExcluded(Symbol.getName()))
|
|
|
|
return;
|
2015-03-04 06:09:53 +00:00
|
|
|
// Dump member enums when dumping their class definition.
|
|
|
|
if (Symbol.isNested())
|
|
|
|
return;
|
2015-02-23 05:58:34 +00:00
|
|
|
|
2015-03-04 06:09:53 +00:00
|
|
|
Printer.NewLine();
|
|
|
|
EnumDumper Dumper(Printer);
|
|
|
|
Dumper.start(Symbol);
|
2015-02-22 22:03:38 +00:00
|
|
|
}
|
|
|
|
|
2015-03-01 06:51:29 +00:00
|
|
|
void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
|
2015-03-01 06:49:49 +00:00
|
|
|
if (Printer.IsTypeExcluded(Symbol.getName()))
|
|
|
|
return;
|
2015-02-23 05:58:34 +00:00
|
|
|
|
2015-03-01 06:49:49 +00:00
|
|
|
Printer.NewLine();
|
2015-02-27 09:15:59 +00:00
|
|
|
TypedefDumper Dumper(Printer);
|
2015-03-01 06:51:29 +00:00
|
|
|
Dumper.start(Symbol);
|
2015-02-22 22:03:38 +00:00
|
|
|
}
|
2015-02-23 05:58:34 +00:00
|
|
|
|
2015-03-01 06:51:29 +00:00
|
|
|
void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
|
2015-02-23 05:58:34 +00:00
|
|
|
if (Symbol.getUnmodifiedTypeId() != 0)
|
|
|
|
return;
|
2015-03-01 06:49:49 +00:00
|
|
|
if (Printer.IsTypeExcluded(Symbol.getName()))
|
|
|
|
return;
|
|
|
|
|
|
|
|
Printer.NewLine();
|
2015-02-23 05:58:34 +00:00
|
|
|
|
2015-03-04 06:09:53 +00:00
|
|
|
if (opts::NoClassDefs) {
|
2015-02-27 09:15:59 +00:00
|
|
|
WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
|
|
|
|
WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
|
2015-03-04 06:09:53 +00:00
|
|
|
} else {
|
|
|
|
ClassDefinitionDumper Dumper(Printer);
|
|
|
|
Dumper.start(Symbol);
|
2015-02-23 05:58:34 +00:00
|
|
|
}
|
|
|
|
}
|