summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h3
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBExtras.cpp4
-rw-r--r--llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp12
-rw-r--r--llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test50
-rw-r--r--llvm/test/tools/llvm-pdbdump/enum-layout.test20
-rw-r--r--llvm/test/tools/llvm-pdbdump/regex-filter.test13
-rw-r--r--llvm/tools/llvm-pdbdump/CMakeLists.txt1
-rw-r--r--llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp5
-rw-r--r--llvm/tools/llvm-pdbdump/EnumDumper.cpp52
-rw-r--r--llvm/tools/llvm-pdbdump/EnumDumper.h30
-rw-r--r--llvm/tools/llvm-pdbdump/TypeDumper.cpp23
-rw-r--r--llvm/tools/llvm-pdbdump/TypeDumper.h3
-rw-r--r--llvm/tools/llvm-pdbdump/VariableDumper.cpp17
-rw-r--r--llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp15
-rw-r--r--llvm/tools/llvm-pdbdump/llvm-pdbdump.h3
15 files changed, 188 insertions, 63 deletions
diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
index a4f8abe6dc0..3188c711915 100644
--- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
+++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h
@@ -26,6 +26,9 @@ public:
void dump(PDBSymDumper &Dumper) const override;
+ std::unique_ptr<PDBSymbolTypeUDT> getClassParent() const;
+ std::unique_ptr<PDBSymbolTypeBuiltin> getUnderlyingType() const;
+
FORWARD_SYMBOL_METHOD(getBuiltinType)
FORWARD_SYMBOL_METHOD(getClassParentId)
FORWARD_SYMBOL_METHOD(getUnmodifiedTypeId)
diff --git a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
index beec3279a8d..4b9437c5824 100644
--- a/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
@@ -303,7 +303,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const Variant &Value) {
OS << Value.Int64;
break;
case PDB_VariantType::Int8:
- OS << Value.Int8;
+ OS << static_cast<int>(Value.Int8);
break;
case PDB_VariantType::Single:
OS << Value.Single;
@@ -318,7 +318,7 @@ raw_ostream &llvm::operator<<(raw_ostream &OS, const Variant &Value) {
OS << Value.UInt64;
break;
case PDB_VariantType::UInt8:
- OS << Value.UInt8;
+ OS << static_cast<unsigned>(Value.UInt8);
break;
default:
OS << Value.Type;
diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
index 87faef82937..8dd26a342e7 100644
--- a/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
+++ b/llvm/lib/DebugInfo/PDB/PDBSymbolTypeEnum.cpp
@@ -9,7 +9,10 @@
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+#include "llvm/DebugInfo/PDB/IPDBSession.h"
#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
#include <utility>
@@ -19,4 +22,13 @@ PDBSymbolTypeEnum::PDBSymbolTypeEnum(const IPDBSession &PDBSession,
std::unique_ptr<IPDBRawSymbol> Symbol)
: PDBSymbol(PDBSession, std::move(Symbol)) {}
+std::unique_ptr<PDBSymbolTypeUDT> PDBSymbolTypeEnum::getClassParent() const {
+ return Session.getConcreteSymbolById<PDBSymbolTypeUDT>(getClassParentId());
+}
+
+std::unique_ptr<PDBSymbolTypeBuiltin>
+PDBSymbolTypeEnum::getUnderlyingType() const {
+ return Session.getConcreteSymbolById<PDBSymbolTypeBuiltin>(getTypeId());
+}
+
void PDBSymbolTypeEnum::dump(PDBSymDumper &Dumper) const { Dumper.dump(*this); }
diff --git a/llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test b/llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test
index 90381f1d91f..6dd15fee4c5 100644
--- a/llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test
+++ b/llvm/test/DebugInfo/PDB/pdbdump-symbol-format.test
@@ -1,6 +1,5 @@
; RUN: llvm-pdbdump -symbols %p/Inputs/symbolformat.pdb | FileCheck --check-prefix=SYM_FORMAT %s
; RUN: llvm-pdbdump -types %p/Inputs/symbolformat.pdb | FileCheck --check-prefix=TYPES_FORMAT %s
-; RUN: llvm-pdbdump -types -class-definitions %p/Inputs/symbolformat.pdb | FileCheck --check-prefix=FULL_CLASS %s
; RUN: llvm-pdbdump -globals %p/Inputs/symbolformat.pdb | FileCheck --check-prefix=GLOBALS %s
; The format is func [0x<rva_start>+<prologue_length> - 0x<rva_end>-<epilogue_length>]
@@ -25,33 +24,28 @@
; TYPES_FORMAT-DAG: typedef int IntType
; TYPES_FORMAT-DAG: typedef class A ClassAType
; TYPES_FORMAT: Classes
-; TYPES_FORMAT-DAG: class A
-; TYPES_FORMAT-DAG: class B
-
-; FULL_CLASS: ---TYPES---
-; FULL_CLASS: Classes
-; FULL_CLASS-DAG: struct A {
-; FULL_CLASS: public:
-; FULL_CLASS: virtual void PureFunc() = 0
-; FULL_CLASS: virtual void VirtualFunc()
-; FULL_CLASS: void RegularFunc()
-; FULL_CLASS: }
-; FULL_CLASS-DAG: struct MemberTest {
-; FULL_CLASS: data +0x00 MemberTest::NestedEnum m_nested_enum
-; FULL_CLASS: data +0x04 int m_typedef
-; FULL_CLASS: data +0x08 bool m_bool
-; FULL_CLASS: data +0x09 char m_char
-; FULL_CLASS: data +0x0a wchar_t m_wchar_t
-; FULL_CLASS: data +0x0c int m_int
-; FULL_CLASS: data +0x10 unsigned m_unsigned
-; FULL_CLASS: data +0x14 long m_long
-; FULL_CLASS: data +0x18 unsigned long m_unsigned_long
-; FULL_CLASS: data +0x20 __int64 m_int64
-; FULL_CLASS: data +0x28 unsigned __int64 m_unsigned_int64
-; FULL_CLASS: data +0x30 float m_float
-; FULL_CLASS: data +0x38 double m_double
-; FULL_CLASS: data +0x40 void (__cdecl *m_pfn_2_args)(int, double)
-; FULL_CLASS: }
+; TYPES_FORMAT: struct A {
+; TYPES_FORMAT: public:
+; TYPES_FORMAT: virtual void PureFunc() = 0
+; TYPES_FORMAT: virtual void VirtualFunc()
+; TYPES_FORMAT: void RegularFunc()
+; TYPES_FORMAT: }
+; TYPES_FORMAT-DAG: struct MemberTest {
+; TYPES_FORMAT: data +0x00 MemberTest::NestedEnum m_nested_enum
+; TYPES_FORMAT: data +0x04 int m_typedef
+; TYPES_FORMAT: data +0x08 bool m_bool
+; TYPES_FORMAT: data +0x09 char m_char
+; TYPES_FORMAT: data +0x0a wchar_t m_wchar_t
+; TYPES_FORMAT: data +0x0c int m_int
+; TYPES_FORMAT: data +0x10 unsigned m_unsigned
+; TYPES_FORMAT: data +0x14 long m_long
+; TYPES_FORMAT: data +0x18 unsigned long m_unsigned_long
+; TYPES_FORMAT: data +0x20 __int64 m_int64
+; TYPES_FORMAT: data +0x28 unsigned __int64 m_unsigned_int64
+; TYPES_FORMAT: data +0x30 float m_float
+; TYPES_FORMAT: data +0x38 double m_double
+; TYPES_FORMAT: data +0x40 void (__cdecl *m_pfn_2_args)(int, double)
+; TYPES_FORMAT: }
; GLOBALS: ---GLOBALS---
; GLOBALS-DAG: func [{{.*}}] (FPO) unsigned __cdecl fpo_func(unsigned n)
diff --git a/llvm/test/tools/llvm-pdbdump/enum-layout.test b/llvm/test/tools/llvm-pdbdump/enum-layout.test
new file mode 100644
index 00000000000..c6145533899
--- /dev/null
+++ b/llvm/test/tools/llvm-pdbdump/enum-layout.test
@@ -0,0 +1,20 @@
+; RUN: llvm-pdbdump -types %p/Inputs/ClassLayoutTest.pdb > %t
+; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBAL_ENUM
+; RUN: FileCheck -input-file=%t %s -check-prefix=MEMBER_ENUM
+
+; GLOBAL_ENUM: ---TYPES---
+; GLOBAL_ENUM: Enums:
+; GLOBAL_ENUM: enum GlobalsTest::Enum {
+; GLOBAL_ENUM-NEXT: Val1 = 0
+; GLOBAL_ENUM-NEXT: }
+
+; MEMBER_ENUM: ---TYPES---
+; MEMBER_ENUM: Classes:
+; MEMBER_ENUM: struct __vc_attributes::threadingAttribute {
+; MEMBER_ENUM-NEXT: enum threading_e {
+; MEMBER_ENUM-NEXT: apartment = 1
+; MEMBER_ENUM-NEXT: single = 2
+; MEMBER_ENUM-NEXT: free = 3
+; MEMBER_ENUM-NEXT: neutral = 4
+; MEMBER_ENUM-NEXT: both = 5
+; MEMBER_ENUM-NEXT: }
diff --git a/llvm/test/tools/llvm-pdbdump/regex-filter.test b/llvm/test/tools/llvm-pdbdump/regex-filter.test
index a0ad17636dd..8b9eca63f58 100644
--- a/llvm/test/tools/llvm-pdbdump/regex-filter.test
+++ b/llvm/test/tools/llvm-pdbdump/regex-filter.test
@@ -1,13 +1,12 @@
-; RUN: llvm-pdbdump -symbols -globals -class-definitions -types %p/Inputs/FilterTest.pdb \
+; RUN: llvm-pdbdump -symbols -globals -types %p/Inputs/FilterTest.pdb \
; RUN: | FileCheck --check-prefix=NO_FILTER %s
-; RUN: llvm-pdbdump -class-definitions -types -exclude-types="GlobalTypedef|NestedTypedef" \
+; RUN: llvm-pdbdump -types -exclude-types="GlobalTypedef|NestedTypedef" \
; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_TYPEDEFS %s
-; RUN: llvm-pdbdump -class-definitions -types -exclude-types="GlobalEnum|NestedEnum" \
+; RUN: llvm-pdbdump -types -exclude-types="GlobalEnum|NestedEnum" \
; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_ENUMS %s
-; RUN: llvm-pdbdump -class-definitions -types -symbols -globals \
-; RUN: -exclude-symbols="MemberVar|GlobalVar" %p/Inputs/FilterTest.pdb | FileCheck \
-; RUN: --check-prefix=EXCLUDE_VARS %s
-; RUN: llvm-pdbdump -types -class-definitions -exclude-types="FilterTestClass" \
+; RUN: llvm-pdbdump -types -symbols -globals -exclude-symbols="MemberVar|GlobalVar" \
+; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_VARS %s
+; RUN: llvm-pdbdump -types -exclude-types="FilterTestClass" \
; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_WHOLE_CLASS %s
; RUN: llvm-pdbdump -symbols -globals -exclude-compilands="FilterTest.obj" \
; RUN: %p/Inputs/FilterTest.pdb | FileCheck --check-prefix=EXCLUDE_COMPILAND %s
diff --git a/llvm/tools/llvm-pdbdump/CMakeLists.txt b/llvm/tools/llvm-pdbdump/CMakeLists.txt
index 341a8496a1b..4dd339cee57 100644
--- a/llvm/tools/llvm-pdbdump/CMakeLists.txt
+++ b/llvm/tools/llvm-pdbdump/CMakeLists.txt
@@ -8,6 +8,7 @@ add_llvm_tool(llvm-pdbdump
BuiltinDumper.cpp
ClassDefinitionDumper.cpp
CompilandDumper.cpp
+ EnumDumper.cpp
FunctionDumper.cpp
LinePrinter.cpp
TypeDumper.cpp
diff --git a/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp b/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
index 5db33a82457..8abf3fa3912 100644
--- a/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
+++ b/llvm/tools/llvm-pdbdump/ClassDefinitionDumper.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "ClassDefinitionDumper.h"
+#include "EnumDumper.h"
#include "FunctionDumper.h"
#include "LinePrinter.h"
#include "llvm-pdbdump.h"
@@ -173,8 +174,8 @@ void ClassDefinitionDumper::dump(const PDBSymbolTypeEnum &Symbol) {
return;
Printer.NewLine();
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
- WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+ EnumDumper Dumper(Printer);
+ Dumper.start(Symbol);
}
void ClassDefinitionDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
diff --git a/llvm/tools/llvm-pdbdump/EnumDumper.cpp b/llvm/tools/llvm-pdbdump/EnumDumper.cpp
new file mode 100644
index 00000000000..3514c39f6e0
--- /dev/null
+++ b/llvm/tools/llvm-pdbdump/EnumDumper.cpp
@@ -0,0 +1,52 @@
+//===- EnumDumper.cpp -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "EnumDumper.h"
+
+#include "BuiltinDumper.h"
+#include "LinePrinter.h"
+#include "llvm-pdbdump.h"
+
+#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
+
+using namespace llvm;
+
+EnumDumper::EnumDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
+
+void EnumDumper::start(const PDBSymbolTypeEnum &Symbol) {
+ WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
+ WithColor(Printer, PDB_ColorItem::Type).get() << Symbol.getName();
+ if (!opts::NoEnumDefs) {
+ auto BuiltinType = Symbol.getUnderlyingType();
+ if (BuiltinType->getBuiltinType() != PDB_BuiltinType::Int ||
+ BuiltinType->getLength() != 4) {
+ Printer << " : ";
+ BuiltinDumper Dumper(Printer);
+ Dumper.start(*BuiltinType);
+ }
+ Printer << " {";
+ Printer.Indent();
+ auto EnumValues = Symbol.findAllChildren<PDBSymbolData>();
+ while (auto EnumValue = EnumValues->getNext()) {
+ if (EnumValue->getDataKind() != PDB_DataKind::Constant)
+ continue;
+ Printer.NewLine();
+ WithColor(Printer, PDB_ColorItem::Identifier).get()
+ << EnumValue->getName();
+ Printer << " = ";
+ WithColor(Printer, PDB_ColorItem::LiteralValue).get()
+ << EnumValue->getValue();
+ }
+ Printer.Unindent();
+ Printer.NewLine();
+ Printer << "}";
+ }
+}
diff --git a/llvm/tools/llvm-pdbdump/EnumDumper.h b/llvm/tools/llvm-pdbdump/EnumDumper.h
new file mode 100644
index 00000000000..23de0614247
--- /dev/null
+++ b/llvm/tools/llvm-pdbdump/EnumDumper.h
@@ -0,0 +1,30 @@
+//===- EnumDumper.h - -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMPDBDUMP_ENUMDUMPER_H
+#define LLVM_TOOLS_LLVMPDBDUMP_ENUMDUMPER_H
+
+#include "llvm/DebugInfo/PDB/PDBSymDumper.h"
+
+namespace llvm {
+
+class LinePrinter;
+
+class EnumDumper : public PDBSymDumper {
+public:
+ EnumDumper(LinePrinter &P);
+
+ void start(const PDBSymbolTypeEnum &Symbol);
+
+private:
+ LinePrinter &Printer;
+};
+}
+
+#endif
diff --git a/llvm/tools/llvm-pdbdump/TypeDumper.cpp b/llvm/tools/llvm-pdbdump/TypeDumper.cpp
index cd0be1227ad..88c0bd65697 100644
--- a/llvm/tools/llvm-pdbdump/TypeDumper.cpp
+++ b/llvm/tools/llvm-pdbdump/TypeDumper.cpp
@@ -9,21 +9,23 @@
#include "TypeDumper.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/PDBSymbolTypeTypedef.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
using namespace llvm;
-TypeDumper::TypeDumper(LinePrinter &P, bool ClassDefs)
- : PDBSymDumper(true), Printer(P), FullClassDefs(ClassDefs) {}
+TypeDumper::TypeDumper(LinePrinter &P) : PDBSymDumper(true), Printer(P) {}
void TypeDumper::start(const PDBSymbolExe &Exe) {
auto Enums = Exe.findAllChildren<PDBSymbolTypeEnum>();
@@ -59,10 +61,13 @@ void TypeDumper::dump(const PDBSymbolTypeEnum &Symbol) {
return;
if (Printer.IsTypeExcluded(Symbol.getName()))
return;
- Printer.NewLine();
+ // Dump member enums when dumping their class definition.
+ if (Symbol.isNested())
+ return;
- WithColor(Printer, PDB_ColorItem::Keyword).get() << "enum ";
- WithColor(Printer, PDB_ColorItem::Identifier).get() << Symbol.getName();
+ Printer.NewLine();
+ EnumDumper Dumper(Printer);
+ Dumper.start(Symbol);
}
void TypeDumper::dump(const PDBSymbolTypeTypedef &Symbol) {
@@ -82,11 +87,11 @@ void TypeDumper::dump(const PDBSymbolTypeUDT &Symbol) {
Printer.NewLine();
- if (FullClassDefs) {
- ClassDefinitionDumper Dumper(Printer);
- Dumper.start(Symbol);
- } else {
+ 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);
}
}
diff --git a/llvm/tools/llvm-pdbdump/TypeDumper.h b/llvm/tools/llvm-pdbdump/TypeDumper.h
index d63019be236..5c0832eccaf 100644
--- a/llvm/tools/llvm-pdbdump/TypeDumper.h
+++ b/llvm/tools/llvm-pdbdump/TypeDumper.h
@@ -18,7 +18,7 @@ class LinePrinter;
class TypeDumper : public PDBSymDumper {
public:
- TypeDumper(LinePrinter &P, bool ClassDefs);
+ TypeDumper(LinePrinter &P);
void start(const PDBSymbolExe &Exe);
@@ -28,7 +28,6 @@ public:
private:
LinePrinter &Printer;
- bool FullClassDefs;
};
}
diff --git a/llvm/tools/llvm-pdbdump/VariableDumper.cpp b/llvm/tools/llvm-pdbdump/VariableDumper.cpp
index a46e1b0c4e9..030610c8c58 100644
--- a/llvm/tools/llvm-pdbdump/VariableDumper.cpp
+++ b/llvm/tools/llvm-pdbdump/VariableDumper.cpp
@@ -17,6 +17,7 @@
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
+#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
@@ -36,14 +37,12 @@ void VariableDumper::start(const PDBSymbolData &Var) {
if (Printer.IsSymbolExcluded(Var.getName()))
return;
- Printer.NewLine();
- Printer << "data ";
-
auto VarType = Var.getType();
switch (auto LocType = Var.getLocationType()) {
case PDB_LocType::Static:
- Printer << "[";
+ Printer.NewLine();
+ Printer << "data [";
WithColor(Printer, PDB_ColorItem::Address).get()
<< format_hex(Var.getRelativeVirtualAddress(), 10);
Printer << "] ";
@@ -51,17 +50,25 @@ void VariableDumper::start(const PDBSymbolData &Var) {
dumpSymbolTypeAndName(*VarType, Var.getName());
break;
case PDB_LocType::Constant:
+ if (isa<PDBSymbolTypeEnum>(*VarType))
+ break;
+ Printer.NewLine();
+ Printer << "data ";
WithColor(Printer, PDB_ColorItem::Keyword).get() << "const ";
dumpSymbolTypeAndName(*VarType, Var.getName());
Printer << " = ";
WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Var.getValue();
break;
case PDB_LocType::ThisRel:
+ Printer.NewLine();
+ Printer << "data ";
WithColor(Printer, PDB_ColorItem::Offset).get()
<< "+" << format_hex(Var.getOffset(), 4) << " ";
dumpSymbolTypeAndName(*VarType, Var.getName());
break;
case PDB_LocType::BitField:
+ Printer.NewLine();
+ Printer << "data ";
WithColor(Printer, PDB_ColorItem::Offset).get()
<< "+" << format_hex(Var.getOffset(), 4) << " ";
dumpSymbolTypeAndName(*VarType, Var.getName());
@@ -69,6 +76,8 @@ void VariableDumper::start(const PDBSymbolData &Var) {
WithColor(Printer, PDB_ColorItem::LiteralValue).get() << Var.getLength();
break;
default:
+ Printer.NewLine();
+ Printer << "data ";
Printer << "unknown(" << LocType << ") ";
WithColor(Printer, PDB_ColorItem::Identifier).get() << Var.getName();
break;
diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
index 1181307fd8a..78535ec0be9 100644
--- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
+++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.cpp
@@ -67,10 +67,6 @@ cl::opt<bool> Globals("globals", cl::desc("Dump global symbols"),
cl::cat(TypeCategory));
cl::opt<bool> Types("types", cl::desc("Display types"), cl::cat(TypeCategory));
cl::opt<bool>
- ClassDefs("class-definitions",
- cl::desc("Display full class definitions (implies -types)"),
- cl::cat(TypeCategory));
-cl::opt<bool>
All("all", cl::desc("Implies all other options in 'Symbol Types' category"),
cl::cat(TypeCategory));
@@ -94,6 +90,12 @@ cl::opt<bool>
ExcludeSystemLibraries("no-system-libs",
cl::desc("Don't show symbols from system libraries"),
cl::cat(FilterCategory));
+cl::opt<bool> NoClassDefs("no-class-definitions",
+ cl::desc("Don't display full class definitions"),
+ cl::cat(FilterCategory));
+cl::opt<bool> NoEnumDefs("no-enum-definitions",
+ cl::desc("Don't display full enum definitions"),
+ cl::cat(FilterCategory));
}
static void dumpInput(StringRef Path) {
@@ -171,7 +173,7 @@ static void dumpInput(StringRef Path) {
Printer.NewLine();
WithColor(Printer, PDB_ColorItem::SectionHeader).get() << "---TYPES---";
Printer.Indent();
- TypeDumper Dumper(Printer, opts::ClassDefs);
+ TypeDumper Dumper(Printer);
Dumper.start(*GlobalScope);
Printer.Unindent();
}
@@ -233,14 +235,11 @@ int main(int argc_, const char *argv_[]) {
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
cl::ParseCommandLineOptions(argv.size(), argv.data(), "LLVM PDB Dumper\n");
- if (opts::ClassDefs)
- opts::Types = true;
if (opts::All) {
opts::Compilands = true;
opts::Symbols = true;
opts::Globals = true;
opts::Types = true;
- opts::ClassDefs = true;
}
if (opts::ExcludeCompilerGenerated) {
opts::ExcludeTypes.push_back("__vc_attributes");
diff --git a/llvm/tools/llvm-pdbdump/llvm-pdbdump.h b/llvm/tools/llvm-pdbdump/llvm-pdbdump.h
index b2f5004d054..586a9ea374e 100644
--- a/llvm/tools/llvm-pdbdump/llvm-pdbdump.h
+++ b/llvm/tools/llvm-pdbdump/llvm-pdbdump.h
@@ -18,11 +18,12 @@ 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> ClassDefs;
extern llvm::cl::opt<bool> All;
extern llvm::cl::opt<bool> ExcludeCompilerGenerated;
+extern llvm::cl::opt<bool> NoClassDefs;
+extern llvm::cl::opt<bool> NoEnumDefs;
extern llvm::cl::list<std::string> ExcludeTypes;
extern llvm::cl::list<std::string> ExcludeSymbols;
extern llvm::cl::list<std::string> ExcludeCompilands;
OpenPOWER on IntegriCloud