mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-04 18:06:49 +00:00
[llvm-pdbdump] Allow pretty to only dump specific types of types.
Previously we just had the -types option, which would dump all classes, typedefs, and enums. But this produces a lot of output if you only want to view classes, for example. This patch breaks this down into 3 additional options, -classes, -enums, and -typedefs, and keeps the -types option around which implies all 3 more specific options. Differential Revision: https://reviews.llvm.org/D31791 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299732 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4d40c97796
commit
dbbede1ea2
@ -29,35 +29,43 @@ using namespace llvm::pdb;
|
||||
TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
|
||||
|
||||
void TypeDumper::start(const PDBSymbolExe &Exe) {
|
||||
auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
|
||||
Printer.NewLine();
|
||||
WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums";
|
||||
Printer << ": (" << Enums->getChildCount() << " items)";
|
||||
Printer.Indent();
|
||||
while (auto Enum = Enums->getNext())
|
||||
Enum->dump(*this);
|
||||
Printer.Unindent();
|
||||
if (opts::pretty::Enums) {
|
||||
auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
|
||||
Printer.NewLine();
|
||||
WithColor(Printer, PDB_ColorItem::Identifier).get() << "Enums";
|
||||
Printer << ": (" << Enums->getChildCount() << " items)";
|
||||
Printer.Indent();
|
||||
while (auto Enum = Enums->getNext())
|
||||
Enum->dump(*this);
|
||||
Printer.Unindent();
|
||||
}
|
||||
|
||||
auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
|
||||
Printer.NewLine();
|
||||
WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs";
|
||||
Printer << ": (" << Typedefs->getChildCount() << " items)";
|
||||
Printer.Indent();
|
||||
while (auto Typedef = Typedefs->getNext())
|
||||
Typedef->dump(*this);
|
||||
Printer.Unindent();
|
||||
if (opts::pretty::Typedefs) {
|
||||
auto Typedefs = Exe.findAllChildren<PDBSymbolTypeTypedef>();
|
||||
Printer.NewLine();
|
||||
WithColor(Printer, PDB_ColorItem::Identifier).get() << "Typedefs";
|
||||
Printer << ": (" << Typedefs->getChildCount() << " items)";
|
||||
Printer.Indent();
|
||||
while (auto Typedef = Typedefs->getNext())
|
||||
Typedef->dump(*this);
|
||||
Printer.Unindent();
|
||||
}
|
||||
|
||||
auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
|
||||
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();
|
||||
if (opts::pretty::Classes) {
|
||||
auto Classes = Exe.findAllChildren<PDBSymbolTypeUDT>();
|
||||
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) {
|
||||
assert(opts::pretty::Enums);
|
||||
|
||||
if (Symbol.getUnmodifiedTypeId() != 0)
|
||||
return;
|
||||
if (Printer.IsTypeExcluded(Symbol.getName()))
|
||||
@ -72,6 +80,8 @@ void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
|
||||
}
|
||||
|
||||
void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
|
||||
assert(opts::pretty::Typedefs);
|
||||
|
||||
if (Printer.IsTypeExcluded(Symbol.getName()))
|
||||
return;
|
||||
|
||||
@ -81,6 +91,8 @@ void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
|
||||
}
|
||||
|
||||
void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
|
||||
assert(opts::pretty::Classes);
|
||||
|
||||
if (Symbol.getUnmodifiedTypeId() != 0)
|
||||
return;
|
||||
if (Printer.IsTypeExcluded(Symbol.getName()))
|
||||
|
@ -112,8 +112,17 @@ cl::opt<bool> Globals("globals", cl::desc("Dump global symbols"),
|
||||
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
|
||||
cl::opt<bool> Externals("externals", cl::desc("Dump external symbols"),
|
||||
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
|
||||
cl::opt<bool> Types("types", cl::desc("Display types"), cl::cat(TypeCategory),
|
||||
cl::sub(PrettySubcommand));
|
||||
cl::opt<bool>
|
||||
Types("types",
|
||||
cl::desc("Display all types (implies -classes, -enums, -typedefs)"),
|
||||
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
|
||||
cl::opt<bool> Classes("classes", cl::desc("Display class types"),
|
||||
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
|
||||
cl::opt<bool> Enums("enums", cl::desc("Display enum types"),
|
||||
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
|
||||
cl::opt<bool> Typedefs("typedefs", cl::desc("Display typedef types"),
|
||||
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
|
||||
|
||||
cl::opt<bool> Lines("lines", cl::desc("Line tables"), cl::cat(TypeCategory),
|
||||
cl::sub(PrettySubcommand));
|
||||
cl::opt<bool>
|
||||
@ -557,7 +566,7 @@ static void dumpPretty(StringRef Path) {
|
||||
Printer.Unindent();
|
||||
}
|
||||
|
||||
if (opts::pretty::Types) {
|
||||
if (opts::pretty::Classes || opts::pretty::Enums || opts::pretty::Typedefs) {
|
||||
Printer.NewLine();
|
||||
WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---TYPES---";
|
||||
Printer.Indent();
|
||||
@ -699,6 +708,12 @@ int main(int argc_, const char *argv_[]) {
|
||||
opts::pretty::Lines = true;
|
||||
}
|
||||
|
||||
if (opts::pretty::Types) {
|
||||
opts::pretty::Classes = true;
|
||||
opts::pretty::Typedefs = true;
|
||||
opts::pretty::Enums = true;
|
||||
}
|
||||
|
||||
// When adding filters for excluded compilands and types, we need to
|
||||
// remember that these are regexes. So special characters such as * and \
|
||||
// need to be escaped in the regex. In the case of a literal \, this means
|
||||
|
@ -20,7 +20,9 @@ namespace pretty {
|
||||
extern llvm::cl::opt<bool> Compilands;
|
||||
extern llvm::cl::opt<bool> Symbols;
|
||||
extern llvm::cl::opt<bool> Globals;
|
||||
extern llvm::cl::opt<bool> Types;
|
||||
extern llvm::cl::opt<bool> Classes;
|
||||
extern llvm::cl::opt<bool> Enums;
|
||||
extern llvm::cl::opt<bool> Typedefs;
|
||||
extern llvm::cl::opt<bool> All;
|
||||
extern llvm::cl::opt<bool> ExcludeCompilerGenerated;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user