summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-04-06 23:43:12 +0000
committerZachary Turner <zturner@google.com>2017-04-06 23:43:12 +0000
commit63230a4e7109b433f8ce09f78b16709229d05bc6 (patch)
treed28e330b501fa6c75de3246d5b0a89763a766d52 /llvm/tools
parent5dcbbbc1c66f9b07c69091885fdb1078ea82315e (diff)
downloadbcm5719-llvm-63230a4e7109b433f8ce09f78b16709229d05bc6.tar.gz
bcm5719-llvm-63230a4e7109b433f8ce09f78b16709229d05bc6.zip
[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 llvm-svn: 299732
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-pdbdump/PrettyTypeDumper.cpp64
-rw-r--r--llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp21
-rw-r--r--llvm/tools/llvm-pdbdump/llvm-pdbdump.h4
3 files changed, 59 insertions, 30 deletions
diff --git a/llvm/tools/llvm-pdbdump/PrettyTypeDumper.cpp b/llvm/tools/llvm-pdbdump/PrettyTypeDumper.cpp
index 4f70c804733..6ed36f879cb 100644
--- a/llvm/tools/llvm-pdbdump/PrettyTypeDumper.cpp
+++ b/llvm/tools/llvm-pdbdump/PrettyTypeDumper.cpp
@@ -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();
-
- 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::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();
+ }
+
+ 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();
+ }
+
+ 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()))
diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
index 76d05c463e3..b22656ffec9 100644
--- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
+++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
@@ -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
diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.h b/llvm/tools/llvm-pdbdump/llvm-pdbdump.h
index 0cf31c8163b..5ad46b4bc17 100644
--- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.h
+++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.h
@@ -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;
OpenPOWER on IntegriCloud