summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-09-14 22:29:19 +0000
committerZachary Turner <zturner@google.com>2018-09-14 22:29:19 +0000
commita98ee586bf6f396b2b6a7deeef24db87bb6736b2 (patch)
tree7deafd44e0e4c1ec7f746a8e2bb7d199305e2005 /llvm/tools
parent7a41693898eed37393a271409ed54cfadb3ddd76 (diff)
downloadbcm5719-llvm-a98ee586bf6f396b2b6a7deeef24db87bb6736b2.tar.gz
bcm5719-llvm-a98ee586bf6f396b2b6a7deeef24db87bb6736b2.zip
[PDB] Make the pretty dumper output modified types.
Currently if we got something like `const Foo` we'd ignore it and just rely on printing the unmodified `Foo` later on. However, for testing the native reading code we really would like to be able to see these so that we can verify that the native reader can actually handle them. Instead of printing out the full type though, just print out the header. llvm-svn: 342295
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-pdbutil/PrettyClassDefinitionDumper.cpp7
-rw-r--r--llvm/tools/llvm-pdbutil/PrettyEnumDumper.cpp12
-rw-r--r--llvm/tools/llvm-pdbutil/PrettyTypeDumper.cpp21
3 files changed, 35 insertions, 5 deletions
diff --git a/llvm/tools/llvm-pdbutil/PrettyClassDefinitionDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyClassDefinitionDumper.cpp
index 651cb8b7649..f009f53a393 100644
--- a/llvm/tools/llvm-pdbutil/PrettyClassDefinitionDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/PrettyClassDefinitionDumper.cpp
@@ -51,6 +51,13 @@ void ClassDefinitionDumper::prettyPrintClassIntro(const ClassLayout &Layout) {
uint32_t Size = Layout.getSize();
const PDBSymbolTypeUDT &Class = Layout.getClass();
+ if (Layout.getClass().isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
+ if (Layout.getClass().isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
+ if (Layout.getClass().isUnalignedType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "unaligned ";
+
WithColor(Printer, PDB_ColorItem::Keyword).get() << Class.getUdtKind() << " ";
WithColor(Printer, PDB_ColorItem::Type).get() << Class.getName();
WithColor(Printer, PDB_ColorItem::Comment).get() << " [sizeof = " << Size
diff --git a/llvm/tools/llvm-pdbutil/PrettyEnumDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyEnumDumper.cpp
index bf22e75e394..f4cbd3f8fa1 100644
--- a/llvm/tools/llvm-pdbutil/PrettyEnumDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/PrettyEnumDumper.cpp
@@ -23,6 +23,18 @@ using namespace llvm::pdb;
EnumDumper::EnumDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
void EnumDumper::start(const PDBSymbolTypeEnum &Symbol) {
+ if (Symbol.getUnmodifiedTypeId() != 0) {
+ if (Symbol.isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
+ if (Symbol.isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
+ if (Symbol.isUnalignedType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "unaligned ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+ return;
+ }
+
WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
if (!opts::pretty::NoEnumDefs) {
diff --git a/llvm/tools/llvm-pdbutil/PrettyTypeDumper.cpp b/llvm/tools/llvm-pdbutil/PrettyTypeDumper.cpp
index 663a608fe42..8eea4c2fb20 100644
--- a/llvm/tools/llvm-pdbutil/PrettyTypeDumper.cpp
+++ b/llvm/tools/llvm-pdbutil/PrettyTypeDumper.cpp
@@ -196,11 +196,22 @@ void TypeDumper::start(const PDBSymbolExe &Exe) {
dumpClassLayout(*Class);
} else {
while (auto Class = Classes->getNext()) {
- if (Class->getUnmodifiedTypeId() != 0)
+ if (Printer.IsTypeExcluded(Class->getName(), Class->getLength()))
continue;
- if (Printer.IsTypeExcluded(Class->getName(), Class->getLength()))
+ if (Class->getUnmodifiedTypeId() != 0) {
+ Printer.NewLine();
+ if (Class->isConstType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
+ if (Class->isVolatileType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "volatile ";
+ if (Class->isUnalignedType())
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "unaligned ";
+ WithColor(Printer, PDB_ColorItem::Keyword).get()
+ << Class->getUdtKind() << " ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Class->getName();
continue;
+ }
auto Layout = llvm::make_unique<ClassLayout>(std::move(Class));
if (Layout->deepPaddingSize() < opts::pretty::PaddingThreshold)
@@ -244,9 +255,9 @@ void TypeDumper::dumpClassLayout(const ClassLayout &Class) {
assert(opts::pretty::Classes);
if (opts::pretty::ClassFormat == opts::pretty::ClassDefinitionFormat::None) {
- Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "class ";
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Class.getName();
+ WithColor(Printer, PDB_ColorItem::Keyword).get()
+ << Class.getClass().getUdtKind() << " ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Class.getName();
} else {
ClassDefinitionDumper Dumper(Printer);
Dumper.start(Class);
OpenPOWER on IntegriCloud