[llvm] r342493 - [PDB] Better support for enumerating pointer types.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 18 09:35:05 PDT 2018
Author: zturner
Date: Tue Sep 18 09:35:05 2018
New Revision: 342493
URL: http://llvm.org/viewvc/llvm-project?rev=342493&view=rev
Log:
[PDB] Better support for enumerating pointer types.
There were several issues with the previous implementation.
1) There were no tests.
2) We didn't support creating PDBSymbolTypePointer records for
builtin types since those aren't described by LF_POINTER
records.
3) We didn't support a wide enough variety of builtin types even
ignoring pointers.
This patch fixes all of these issues. In order to add tests,
it's helpful to be able to ignore the symbol index id hierarchy
because it makes the golden output from the DIA version not match
our output, so I've extended the dumper to disable dumping of id
fields.
Added:
llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.cpp
llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.pdb (with props)
llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-pointers.test
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h
llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h
llvm/trunk/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
llvm/trunk/include/llvm/DebugInfo/PDB/PDBSymbol.h
llvm/trunk/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp
llvm/trunk/lib/DebugInfo/PDB/PDBSymbol.cpp
llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-compilands.test
llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-enums.test
llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeIndex.h Tue Sep 18 09:35:05 2018
@@ -134,6 +134,8 @@ public:
return static_cast<SimpleTypeMode>(Index & SimpleModeMask);
}
+ TypeIndex makeDirect() const { return TypeIndex{getSimpleKind()}; }
+
static TypeIndex None() { return TypeIndex(SimpleTypeKind::None); }
static TypeIndex Void() { return TypeIndex(SimpleTypeKind::Void); }
static TypeIndex VoidPointer32() {
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h Tue Sep 18 09:35:05 2018
@@ -20,7 +20,8 @@ class DIARawSymbol : public IPDBRawSymbo
public:
DIARawSymbol(const DIASession &PDBSession, CComPtr<IDiaSymbol> DiaSymbol);
- void dump(raw_ostream &OS, int Indent) const override;
+ void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const override;
CComPtr<IDiaSymbol> getDiaSymbol() const { return Symbol; }
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h Tue Sep 18 09:35:05 2018
@@ -11,6 +11,7 @@
#define LLVM_DEBUGINFO_PDB_IPDBRAWSYMBOL_H
#include "PDBTypes.h"
+#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
@@ -21,9 +22,21 @@ class raw_ostream;
namespace pdb {
+class IPDBSession;
class PDBSymbolTypeVTable;
class PDBSymbolTypeVTableShape;
+enum class PdbSymbolIdField : uint32_t {
+ None = 0,
+ SymIndexId = 1 << 0,
+ LexicalParent = 1 << 1,
+ ClassParent = 1 << 2,
+ Type = 1 << 3,
+ UnmodifiedType = 1 << 4,
+ All = 0xFFFFFFFF,
+ LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ All)
+};
+
template <typename T>
void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {
OS << "\n";
@@ -31,6 +44,11 @@ void dumpSymbolField(raw_ostream &OS, St
OS << Name << ": " << Value;
}
+void dumpSymbolIdField(raw_ostream &OS, StringRef Name, SymIndexId Value,
+ int Indent, const IPDBSession &Session,
+ PdbSymbolIdField FieldId, PdbSymbolIdField ShowFlags,
+ PdbSymbolIdField RecurseFlags);
+
/// IPDBRawSymbol defines an interface used to represent an arbitrary symbol.
/// It exposes a monolithic interface consisting of accessors for the union of
/// all properties that are valid for any symbol type. This interface is then
@@ -40,7 +58,8 @@ class IPDBRawSymbol {
public:
virtual ~IPDBRawSymbol();
- virtual void dump(raw_ostream &OS, int Indent) const = 0;
+ virtual void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const = 0;
virtual std::unique_ptr<IPDBEnumSymbols>
findChildren(PDB_SymType Type) const = 0;
@@ -244,6 +263,8 @@ public:
virtual std::string getUnused() const = 0;
};
+LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
+
} // namespace pdb
} // namespace llvm
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h Tue Sep 18 09:35:05 2018
@@ -21,7 +21,8 @@ public:
NativeCompilandSymbol(NativeSession &Session, SymIndexId SymbolId,
DbiModuleDescriptor MI);
- void dump(raw_ostream &OS, int Indent) const override;
+ void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const override;
PDB_SymType getSymTag() const override;
bool isEditAndContinueEnabled() const override;
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h Tue Sep 18 09:35:05 2018
@@ -24,7 +24,8 @@ public:
NativeRawSymbol(NativeSession &PDBSession, PDB_SymType Tag,
SymIndexId SymbolId);
- void dump(raw_ostream &OS, int Indent) const override;
+ void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const override;
std::unique_ptr<IPDBEnumSymbols>
findChildren(PDB_SymType Type) const override;
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeSymbolEnumerator.h Tue Sep 18 09:35:05 2018
@@ -26,7 +26,8 @@ public:
~NativeSymbolEnumerator() override;
- void dump(raw_ostream &OS, int Indent) const override;
+ void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const override;
SymIndexId getClassParentId() const override;
SymIndexId getLexicalParentId() const override;
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h Tue Sep 18 09:35:05 2018
@@ -26,7 +26,8 @@ public:
uint64_t L);
~NativeTypeBuiltin() override;
- void dump(raw_ostream &OS, int Indent) const override;
+ void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const override;
PDB_SymType getSymTag() const override;
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h Tue Sep 18 09:35:05 2018
@@ -31,7 +31,8 @@ public:
codeview::EnumRecord EnumRecord);
~NativeTypeEnum() override;
- void dump(raw_ostream &OS, int Indent) const override;
+ void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const override;
std::unique_ptr<IPDBEnumSymbols>
findChildren(PDB_SymType Type) const override;
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h Tue Sep 18 09:35:05 2018
@@ -11,6 +11,7 @@
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
+#include "llvm/ADT/Optional.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
@@ -21,11 +22,17 @@ namespace pdb {
class NativeTypePointer : public NativeRawSymbol {
public:
+ // Create a pointer record for a simple type.
+ NativeTypePointer(NativeSession &Session, SymIndexId Id,
+ codeview::TypeIndex TI);
+
+ // Create a pointer record for a non-simple type.
NativeTypePointer(NativeSession &Session, SymIndexId Id,
codeview::TypeIndex TI, codeview::PointerRecord PR);
~NativeTypePointer() override;
- void dump(raw_ostream &OS, int Indent) const override;
+ void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const override;
bool isConstType() const override;
uint64_t getLength() const override;
@@ -40,7 +47,7 @@ public:
protected:
codeview::TypeIndex TI;
- codeview::PointerRecord Record;
+ Optional<codeview::PointerRecord> Record;
};
} // namespace pdb
Modified: llvm/trunk/include/llvm/DebugInfo/PDB/PDBSymbol.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/PDBSymbol.h?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/PDB/PDBSymbol.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/PDB/PDBSymbol.h Tue Sep 18 09:35:05 2018
@@ -112,7 +112,8 @@ public:
/// normally goes on the right side of the symbol.
virtual void dumpRight(PDBSymDumper &Dumper) const {}
- void defaultDump(raw_ostream &OS, int Indent) const;
+ void defaultDump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowFlags,
+ PdbSymbolIdField RecurseFlags) const;
void dumpProperties() const;
void dumpChildStats() const;
Modified: llvm/trunk/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp Tue Sep 18 09:35:05 2018
@@ -150,6 +150,17 @@ void DumpDIAValueAs(llvm::raw_ostream &O
dumpSymbolField(OS, Name, static_cast<PrintType>(Value), Indent);
}
+void DumpDIAIdValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
+ IDiaSymbol *Symbol,
+ HRESULT (__stdcall IDiaSymbol::*Method)(DWORD *),
+ const IPDBSession &Session, PdbSymbolIdField FieldId,
+ PdbSymbolIdField ShowFlags, PdbSymbolIdField RecurseFlags) {
+ DWORD Value;
+ if (S_OK == (Symbol->*Method)(&Value))
+ dumpSymbolIdField(OS, Name, Value, Indent, Session, FieldId, ShowFlags,
+ RecurseFlags);
+}
+
template <typename ArgType>
void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
IDiaSymbol *Symbol,
@@ -199,6 +210,12 @@ DIARawSymbol::DIARawSymbol(const DIASess
CComPtr<IDiaSymbol> DiaSymbol)
: Session(PDBSession), Symbol(DiaSymbol) {}
+#define RAW_ID_METHOD_DUMP(Stream, Method, Session, FieldId, ShowFlags, \
+ RecurseFlags) \
+ DumpDIAIdValue(Stream, Indent, StringRef{#Method}, Symbol, \
+ &IDiaSymbol::get_##Method, Session, FieldId, ShowFlags, \
+ RecurseFlags);
+
#define RAW_METHOD_DUMP(Stream, Method) \
DumpDIAValue(Stream, Indent, StringRef{#Method}, Symbol, \
&IDiaSymbol::get_##Method);
@@ -207,9 +224,12 @@ DIARawSymbol::DIARawSymbol(const DIASess
DumpDIAValueAs<Type>(Stream, Indent, StringRef{#Method}, Symbol, \
&IDiaSymbol::get_##Method);
-void DIARawSymbol::dump(raw_ostream &OS, int Indent) const {
- RAW_METHOD_DUMP(OS, symIndexId);
- RAW_METHOD_DUMP(OS, symTag);
+void DIARawSymbol::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {
+ RAW_ID_METHOD_DUMP(OS, symIndexId, Session, PdbSymbolIdField::SymIndexId,
+ ShowIdFields, RecurseIdFields);
+ RAW_METHOD_DUMP_AS(OS, symTag, PDB_SymType);
RAW_METHOD_DUMP(OS, access);
RAW_METHOD_DUMP(OS, addressOffset);
@@ -226,7 +246,8 @@ void DIARawSymbol::dump(raw_ostream &OS,
RAW_METHOD_DUMP(OS, baseType);
RAW_METHOD_DUMP(OS, bitPosition);
RAW_METHOD_DUMP(OS, callingConvention);
- RAW_METHOD_DUMP(OS, classParentId);
+ RAW_ID_METHOD_DUMP(OS, classParentId, Session, PdbSymbolIdField::ClassParent,
+ ShowIdFields, RecurseIdFields);
RAW_METHOD_DUMP(OS, compilerName);
RAW_METHOD_DUMP(OS, count);
RAW_METHOD_DUMP(OS, countLiveRanges);
@@ -234,7 +255,9 @@ void DIARawSymbol::dump(raw_ostream &OS,
RAW_METHOD_DUMP(OS, frontEndMinor);
RAW_METHOD_DUMP(OS, frontEndBuild);
RAW_METHOD_DUMP(OS, frontEndQFE);
- RAW_METHOD_DUMP(OS, lexicalParentId);
+ RAW_ID_METHOD_DUMP(OS, lexicalParentId, Session,
+ PdbSymbolIdField::LexicalParent, ShowIdFields,
+ RecurseIdFields);
RAW_METHOD_DUMP(OS, libraryName);
RAW_METHOD_DUMP(OS, liveRangeStartAddressOffset);
RAW_METHOD_DUMP(OS, liveRangeStartAddressSection);
@@ -272,10 +295,13 @@ void DIARawSymbol::dump(raw_ostream &OS,
RAW_METHOD_DUMP(OS, textureSlot);
RAW_METHOD_DUMP(OS, timeStamp);
RAW_METHOD_DUMP(OS, token);
- RAW_METHOD_DUMP(OS, typeId);
+ RAW_ID_METHOD_DUMP(OS, typeId, Session, PdbSymbolIdField::Type, ShowIdFields,
+ RecurseIdFields);
RAW_METHOD_DUMP(OS, uavSlot);
RAW_METHOD_DUMP(OS, undecoratedName);
- RAW_METHOD_DUMP(OS, unmodifiedTypeId);
+ RAW_ID_METHOD_DUMP(OS, unmodifiedTypeId, Session,
+ PdbSymbolIdField::UnmodifiedType, ShowIdFields,
+ RecurseIdFields);
RAW_METHOD_DUMP(OS, upperBoundId);
RAW_METHOD_DUMP(OS, virtualBaseDispIndex);
RAW_METHOD_DUMP(OS, virtualBaseOffset);
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp Tue Sep 18 09:35:05 2018
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/ADT/STLExtras.h"
@@ -23,10 +24,14 @@ PDB_SymType NativeCompilandSymbol::getSy
return PDB_SymType::Compiland;
}
-void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent) const {
- NativeRawSymbol::dump(OS, Indent);
-
- dumpSymbolField(OS, "lexicalParentId", 0, Indent);
+void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {
+ NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
+
+ dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
+ PdbSymbolIdField::LexicalParent, ShowIdFields,
+ RecurseIdFields);
dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
dumpSymbolField(OS, "name", getName(), Indent);
dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp Tue Sep 18 09:35:05 2018
@@ -9,6 +9,7 @@
#include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
+#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
#include "llvm/Support/FormatVariadic.h"
@@ -19,9 +20,13 @@ NativeRawSymbol::NativeRawSymbol(NativeS
SymIndexId SymbolId)
: Session(PDBSession), Tag(Tag), SymbolId(SymbolId) {}
-void NativeRawSymbol::dump(raw_ostream &OS, int Indent) const {
- dumpSymbolField(OS, "symIndexId", SymbolId, Indent);
- dumpSymbolField(OS, "symTag", static_cast<uint32_t>(Tag), Indent);
+void NativeRawSymbol::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {
+ dumpSymbolIdField(OS, "symIndexId", SymbolId, Indent, Session,
+ PdbSymbolIdField::SymIndexId, ShowIdFields,
+ RecurseIdFields);
+ dumpSymbolField(OS, "symTag", Tag, Indent);
}
std::unique_ptr<IPDBEnumSymbols>
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeSymbolEnumerator.cpp Tue Sep 18 09:35:05 2018
@@ -25,12 +25,19 @@ NativeSymbolEnumerator::NativeSymbolEnum
NativeSymbolEnumerator::~NativeSymbolEnumerator() {}
-void NativeSymbolEnumerator::dump(raw_ostream &OS, int Indent) const {
- NativeRawSymbol::dump(OS, Indent);
- dumpSymbolField(OS, "classParentId", getClassParentId(), Indent);
- dumpSymbolField(OS, "lexicalParentId", getLexicalParentId(), Indent);
+void NativeSymbolEnumerator::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {
+ NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
+ dumpSymbolIdField(OS, "classParentId", getClassParentId(), Indent, Session,
+ PdbSymbolIdField::ClassParent, ShowIdFields,
+ RecurseIdFields);
+ dumpSymbolIdField(OS, "lexicalParentId", getLexicalParentId(), Indent,
+ Session, PdbSymbolIdField::LexicalParent, ShowIdFields,
+ RecurseIdFields);
dumpSymbolField(OS, "name", getName(), Indent);
- dumpSymbolField(OS, "typeId", getTypeId(), Indent);
+ dumpSymbolIdField(OS, "typeId", getTypeId(), Indent, Session,
+ PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields);
dumpSymbolField(OS, "dataKind", getDataKind(), Indent);
dumpSymbolField(OS, "locationType", getLocationType(), Indent);
dumpSymbolField(OS, "constType", isConstType(), Indent);
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp Tue Sep 18 09:35:05 2018
@@ -21,8 +21,9 @@ NativeTypeBuiltin::NativeTypeBuiltin(Nat
NativeTypeBuiltin::~NativeTypeBuiltin() {}
-void NativeTypeBuiltin::dump(raw_ostream &OS, int Indent) const {
-}
+void NativeTypeBuiltin::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {}
PDB_SymType NativeTypeBuiltin::getSymTag() const {
return PDB_SymType::BuiltinType;
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp Tue Sep 18 09:35:05 2018
@@ -130,16 +130,23 @@ NativeTypeEnum::NativeTypeEnum(NativeSes
NativeTypeEnum::~NativeTypeEnum() {}
-void NativeTypeEnum::dump(raw_ostream &OS, int Indent) const {
- NativeRawSymbol::dump(OS, Indent);
+void NativeTypeEnum::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {
+ NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
dumpSymbolField(OS, "baseType", static_cast<uint32_t>(getBuiltinType()),
Indent);
- dumpSymbolField(OS, "lexicalParentId", 0, Indent);
+ dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
+ PdbSymbolIdField::LexicalParent, ShowIdFields,
+ RecurseIdFields);
dumpSymbolField(OS, "name", getName(), Indent);
- dumpSymbolField(OS, "typeId", getTypeId(), Indent);
+ dumpSymbolIdField(OS, "typeId", getTypeId(), Indent, Session,
+ PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields);
if (Modifiers.hasValue())
- dumpSymbolField(OS, "unmodifiedTypeId", getUnmodifiedTypeId(), Indent);
+ dumpSymbolIdField(OS, "unmodifiedTypeId", getUnmodifiedTypeId(), Indent,
+ Session, PdbSymbolIdField::UnmodifiedType, ShowIdFields,
+ RecurseIdFields);
dumpSymbolField(OS, "length", getLength(), Indent);
dumpSymbolField(OS, "constructor", hasConstructor(), Indent);
dumpSymbolField(OS, "constType", isConstType(), Indent);
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp Tue Sep 18 09:35:05 2018
@@ -18,6 +18,13 @@ using namespace llvm::codeview;
using namespace llvm::pdb;
NativeTypePointer::NativeTypePointer(NativeSession &Session, SymIndexId Id,
+ codeview::TypeIndex TI)
+ : NativeRawSymbol(Session, PDB_SymType::PointerType, Id), TI(TI) {
+ assert(TI.isSimple());
+ assert(TI.getSimpleMode() != SimpleTypeMode::Direct);
+}
+
+NativeTypePointer::NativeTypePointer(NativeSession &Session, SymIndexId Id,
codeview::TypeIndex TI,
codeview::PointerRecord Record)
: NativeRawSymbol(Session, PDB_SymType::PointerType, Id), TI(TI),
@@ -25,11 +32,16 @@ NativeTypePointer::NativeTypePointer(Nat
NativeTypePointer::~NativeTypePointer() {}
-void NativeTypePointer::dump(raw_ostream &OS, int Indent) const {
- NativeRawSymbol::dump(OS, Indent);
-
- dumpSymbolField(OS, "lexicalParentId", 0, Indent);
- dumpSymbolField(OS, "typeId", getTypeId(), Indent);
+void NativeTypePointer::dump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowIdFields,
+ PdbSymbolIdField RecurseIdFields) const {
+ NativeRawSymbol::dump(OS, Indent, ShowIdFields, RecurseIdFields);
+
+ dumpSymbolIdField(OS, "lexicalParentId", 0, Indent, Session,
+ PdbSymbolIdField::LexicalParent, ShowIdFields,
+ RecurseIdFields);
+ dumpSymbolIdField(OS, "typeId", getTypeId(), Indent, Session,
+ PdbSymbolIdField::Type, ShowIdFields, RecurseIdFields);
dumpSymbolField(OS, "length", getLength(), Indent);
dumpSymbolField(OS, "constType", isConstType(), Indent);
dumpSymbolField(OS, "isPointerToDataMember", isPointerToDataMember(), Indent);
@@ -42,45 +54,82 @@ void NativeTypePointer::dump(raw_ostream
dumpSymbolField(OS, "volatileType", isVolatileType(), Indent);
}
-uint64_t NativeTypePointer::getLength() const { return Record.getSize(); }
+uint64_t NativeTypePointer::getLength() const {
+ if (Record)
+ return Record->getSize();
+
+ switch (TI.getSimpleMode()) {
+ case SimpleTypeMode::NearPointer:
+ case SimpleTypeMode::FarPointer:
+ case SimpleTypeMode::HugePointer:
+ return 2;
+ case SimpleTypeMode::NearPointer32:
+ case SimpleTypeMode::FarPointer32:
+ return 4;
+ case SimpleTypeMode::NearPointer64:
+ return 8;
+ case SimpleTypeMode::NearPointer128:
+ return 16;
+ default:
+ assert(false && "invalid simple type mode!");
+ }
+ return 0;
+}
SymIndexId NativeTypePointer::getTypeId() const {
// This is the pointee SymIndexId.
- return Session.getSymbolCache().findSymbolByTypeIndex(Record.ReferentType);
+ TypeIndex Referent = Record ? Record->ReferentType : TI.makeDirect();
+
+ return Session.getSymbolCache().findSymbolByTypeIndex(Referent);
}
bool NativeTypePointer::isReference() const {
- return Record.getMode() == PointerMode::LValueReference ||
- isRValueReference();
+ if (!Record)
+ return false;
+ return Record->getMode() == PointerMode::LValueReference;
}
bool NativeTypePointer::isRValueReference() const {
- return Record.getMode() == PointerMode::RValueReference;
+ if (!Record)
+ return false;
+ return Record->getMode() == PointerMode::RValueReference;
}
bool NativeTypePointer::isPointerToDataMember() const {
- return Record.getMode() == PointerMode::PointerToDataMember;
+ if (!Record)
+ return false;
+ return Record->getMode() == PointerMode::PointerToDataMember;
}
bool NativeTypePointer::isPointerToMemberFunction() const {
- return Record.getMode() == PointerMode::PointerToMemberFunction;
+ if (!Record)
+ return false;
+ return Record->getMode() == PointerMode::PointerToMemberFunction;
}
bool NativeTypePointer::isConstType() const {
- return (Record.getOptions() & PointerOptions::Const) != PointerOptions::None;
+ if (!Record)
+ return false;
+ return (Record->getOptions() & PointerOptions::Const) != PointerOptions::None;
}
bool NativeTypePointer::isRestrictedType() const {
- return (Record.getOptions() & PointerOptions::Restrict) !=
+ if (!Record)
+ return false;
+ return (Record->getOptions() & PointerOptions::Restrict) !=
PointerOptions::None;
}
bool NativeTypePointer::isVolatileType() const {
- return (Record.getOptions() & PointerOptions::Volatile) !=
+ if (!Record)
+ return false;
+ return (Record->getOptions() & PointerOptions::Volatile) !=
PointerOptions::None;
}
bool NativeTypePointer::isUnalignedType() const {
- return (Record.getOptions() & PointerOptions::Unaligned) !=
+ if (!Record)
+ return false;
+ return (Record->getOptions() & PointerOptions::Unaligned) !=
PointerOptions::None;
}
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/SymbolCache.cpp Tue Sep 18 09:35:05 2018
@@ -65,18 +65,20 @@ SymbolCache::createTypeEnumerator(codevi
SymIndexId SymbolCache::createSimpleType(TypeIndex Index,
ModifierOptions Mods) {
- // FIXME: We will eventually need to handle pointers to other simple types,
- // which are still simple types in the world of CodeView TypeIndexes.
- if (Index.getSimpleMode() != codeview::SimpleTypeMode::Direct)
- return 0;
+ if (Index.getSimpleMode() != codeview::SimpleTypeMode::Direct) {
+ SymIndexId Id = Cache.size();
+ Cache.emplace_back(
+ llvm::make_unique<NativeTypePointer>(Session, Id, Index));
+ return Id;
+ }
+ SymIndexId Id = Cache.size();
const auto Kind = Index.getSimpleKind();
const auto It = std::find_if(
std::begin(BuiltinTypes), std::end(BuiltinTypes),
[Kind](const BuiltinTypeEntry &Builtin) { return Builtin.Kind == Kind; });
if (It == std::end(BuiltinTypes))
return 0;
- SymIndexId Id = Cache.size();
Cache.emplace_back(llvm::make_unique<NativeTypeBuiltin>(Session, Id, Mods,
It->Type, It->Size));
TypeIndexToSymbolId[Index] = Id;
@@ -175,12 +177,16 @@ SymbolCache::getSymbolById(SymIndexId Sy
assert(SymbolId < Cache.size());
// Id 0 is reserved.
- if (SymbolId == 0)
+ if (SymbolId == 0 || SymbolId >= Cache.size())
+ return nullptr;
+
+ // Make sure to handle the case where we've inserted a placeholder symbol
+ // for types we don't yet suppport.
+ NativeRawSymbol *NRS = Cache[SymbolId].get();
+ if (!NRS)
return nullptr;
- // If the caller has a SymbolId, it'd better be in our SymbolCache.
- return SymbolId < Cache.size() ? PDBSymbol::create(Session, *Cache[SymbolId])
- : nullptr;
+ return PDBSymbol::create(Session, *NRS);
}
NativeRawSymbol &SymbolCache::getNativeSymbolById(SymIndexId SymbolId) const {
Modified: llvm/trunk/lib/DebugInfo/PDB/PDBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/PDBSymbol.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/PDBSymbol.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/PDBSymbol.cpp Tue Sep 18 09:35:05 2018
@@ -115,13 +115,15 @@ std::unique_ptr<PDBSymbol> PDBSymbol::cr
return SymbolPtr;
}
-void PDBSymbol::defaultDump(raw_ostream &OS, int Indent) const {
- RawSymbol->dump(OS, Indent);
+void PDBSymbol::defaultDump(raw_ostream &OS, int Indent,
+ PdbSymbolIdField ShowFlags,
+ PdbSymbolIdField RecurseFlags) const {
+ RawSymbol->dump(OS, Indent, ShowFlags, RecurseFlags);
}
void PDBSymbol::dumpProperties() const {
outs() << "\n";
- defaultDump(outs(), 0);
+ defaultDump(outs(), 0, PdbSymbolIdField::All, PdbSymbolIdField::None);
outs().flush();
}
@@ -180,3 +182,34 @@ PDBSymbol::getChildStats(TagStats &Stats
std::unique_ptr<PDBSymbol> PDBSymbol::getSymbolByIdHelper(uint32_t Id) const {
return Session.getSymbolById(Id);
}
+
+void llvm::pdb::dumpSymbolIdField(raw_ostream &OS, StringRef Name,
+ SymIndexId Value, int Indent,
+ const IPDBSession &Session,
+ PdbSymbolIdField FieldId,
+ PdbSymbolIdField ShowFlags,
+ PdbSymbolIdField RecurseFlags) {
+ if ((FieldId & ShowFlags) == PdbSymbolIdField::None)
+ return;
+
+ OS << "\n";
+ OS.indent(Indent);
+ OS << Name << ": " << Value;
+ // Don't recurse unless the user requested it.
+ if ((FieldId & RecurseFlags) == PdbSymbolIdField::None)
+ return;
+ // And obviously don't recurse on the symbol itself.
+ if (FieldId == PdbSymbolIdField::SymIndexId)
+ return;
+
+ auto Child = Session.getSymbolById(Value);
+
+ // It could have been a placeholder symbol for a type we don't yet support,
+ // so just exit in that case.
+ if (!Child)
+ return;
+
+ // Don't recurse more than once, so pass PdbSymbolIdField::None) for the
+ // recurse flags.
+ Child->defaultDump(OS, Indent + 2, ShowFlags, PdbSymbolIdField::None);
+}
Added: llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.cpp?rev=342493&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.cpp (added)
+++ llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.cpp Tue Sep 18 09:35:05 2018
@@ -0,0 +1,48 @@
+// Build with "cl.exe /Zi /GR- /GX- every-pointer.cpp /link /debug /nodefaultlib /incremental:no /entry:main"
+
+#include <stdint.h>
+
+// clang-format off
+void *__purecall = 0;
+
+void __cdecl operator delete(void *,unsigned int) {}
+void __cdecl operator delete(void *,unsigned __int64) {}
+
+
+struct Foo {
+ int X = 0;
+ int func() { return 42; }
+};
+
+int *IntP = nullptr;
+Foo *FooP = nullptr;
+
+Foo F;
+
+Foo __unaligned *UFooP = &F;
+Foo * __restrict RFooP = &F;
+
+const Foo * CFooP = &F;
+volatile Foo * VFooP = &F;
+const volatile Foo * CVFooP = &F;
+
+template<typename T> void f(T t) {}
+
+int main(int argc, char **argv) {
+ f<int*>(IntP);
+ f<Foo*>(FooP);
+
+ f<Foo __unaligned *>(UFooP);
+ f<Foo *__restrict>(RFooP);
+
+ f<const Foo*>(CFooP);
+ f<volatile Foo*>(VFooP);
+ f<const volatile Foo*>(CVFooP);
+
+ f<Foo&>(F);
+ f<Foo&&>(static_cast<Foo&&>(F));
+
+ f(&Foo::X);
+ f(&Foo::func);
+ return 0;
+}
Added: llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.pdb
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.pdb?rev=342493&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/DebugInfo/PDB/Inputs/every-pointer.pdb
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-compilands.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-compilands.test?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-compilands.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-compilands.test Tue Sep 18 09:35:05 2018
@@ -68,16 +68,14 @@ BIGREAD: * Linker *
DUMP: {
DUMP-NEXT: symIndexId: 2
-DUMP-NEXT: symTag: 2
-DUMP-NEXT: lexicalParentId: 0
+DUMP-NEXT: symTag: Compiland
DUMP-NEXT: libraryName: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
DUMP-NEXT: name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
DUMP-NEXT: editAndContinueEnabled: 0
DUMP-NEXT: }
DUMP-NEXT: {
DUMP-NEXT: symIndexId: 3
-DUMP-NEXT: symTag: 2
-DUMP-NEXT: lexicalParentId: 0
+DUMP-NEXT: symTag: Compiland
DUMP-NEXT: libraryName:
DUMP-NEXT: name: * Linker *
DUMP-NEXT: editAndContinueEnabled: 0
Modified: llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-enums.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-enums.test?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-enums.test (original)
+++ llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-enums.test Tue Sep 18 09:35:05 2018
@@ -10,7 +10,7 @@
; RUN: llvm-pdbutil pretty -native -enums %p/../Inputs/every-enum.pdb \
; RUN: | FileCheck -check-prefix=ENUMS %s
-; RUN: llvm-pdbutil diadump -native -enums %p/../Inputs/every-enum.pdb \
+; RUN: llvm-pdbutil diadump -hierarchy -native -enums %p/../Inputs/every-enum.pdb \
; RUN: | FileCheck -check-prefix=DUMP %s
@@ -81,7 +81,7 @@ ENUMS: const volatile enum EC
DUMP: {
DUMP: symIndexId: 2
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 2
DUMP: lexicalParentId: 0
DUMP: name: I8
@@ -104,7 +104,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 4
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 2
DUMP: lexicalParentId: 0
DUMP: name: I8A
@@ -118,7 +118,7 @@ DUMP: value: -128
DUMP: }
DUMP: {
DUMP: symIndexId: 5
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 2
DUMP: lexicalParentId: 0
DUMP: name: I8B
@@ -132,7 +132,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 6
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 2
DUMP: lexicalParentId: 0
DUMP: name: I8C
@@ -147,7 +147,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 7
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 6
DUMP: lexicalParentId: 0
DUMP: name: I16
@@ -170,7 +170,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 9
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 7
DUMP: lexicalParentId: 0
DUMP: name: I16A
@@ -184,7 +184,7 @@ DUMP: value: -32768
DUMP: }
DUMP: {
DUMP: symIndexId: 10
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 7
DUMP: lexicalParentId: 0
DUMP: name: I16B
@@ -198,7 +198,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 11
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 7
DUMP: lexicalParentId: 0
DUMP: name: I16C
@@ -213,7 +213,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 12
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 6
DUMP: lexicalParentId: 0
DUMP: name: I32
@@ -236,7 +236,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 14
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 12
DUMP: lexicalParentId: 0
DUMP: name: I32A
@@ -250,7 +250,7 @@ DUMP: value: -2147483648
DUMP: }
DUMP: {
DUMP: symIndexId: 15
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 12
DUMP: lexicalParentId: 0
DUMP: name: I32B
@@ -264,7 +264,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 16
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 12
DUMP: lexicalParentId: 0
DUMP: name: I32C
@@ -279,7 +279,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 17
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 6
DUMP: lexicalParentId: 0
DUMP: name: I64
@@ -302,7 +302,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 19
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 17
DUMP: lexicalParentId: 0
DUMP: name: I64A
@@ -316,7 +316,7 @@ DUMP: value: -9223372036854775808
DUMP: }
DUMP: {
DUMP: symIndexId: 20
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 17
DUMP: lexicalParentId: 0
DUMP: name: I64B
@@ -330,7 +330,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 21
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 17
DUMP: lexicalParentId: 0
DUMP: name: I64C
@@ -345,7 +345,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 22
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 2
DUMP: lexicalParentId: 0
DUMP: name: U8
@@ -368,7 +368,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 24
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 22
DUMP: lexicalParentId: 0
DUMP: name: U8A
@@ -382,7 +382,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 25
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 22
DUMP: lexicalParentId: 0
DUMP: name: U8B
@@ -397,7 +397,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 26
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 7
DUMP: lexicalParentId: 0
DUMP: name: U16
@@ -420,7 +420,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 28
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 26
DUMP: lexicalParentId: 0
DUMP: name: U16A
@@ -434,7 +434,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 29
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 26
DUMP: lexicalParentId: 0
DUMP: name: U16B
@@ -449,7 +449,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 30
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 7
DUMP: lexicalParentId: 0
DUMP: name: U32
@@ -472,7 +472,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 32
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 30
DUMP: lexicalParentId: 0
DUMP: name: U32A
@@ -486,7 +486,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 33
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 30
DUMP: lexicalParentId: 0
DUMP: name: U32B
@@ -501,7 +501,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 34
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 7
DUMP: lexicalParentId: 0
DUMP: name: U64
@@ -524,7 +524,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 36
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 34
DUMP: lexicalParentId: 0
DUMP: name: U64A
@@ -538,7 +538,7 @@ DUMP: value: 0
DUMP: }
DUMP: {
DUMP: symIndexId: 37
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 34
DUMP: lexicalParentId: 0
DUMP: name: U64B
@@ -553,7 +553,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 38
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 7
DUMP: lexicalParentId: 0
DUMP: name: Char16
@@ -576,7 +576,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 39
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 38
DUMP: lexicalParentId: 0
DUMP: name: C16A
@@ -590,7 +590,7 @@ DUMP: value: 97
DUMP: }
DUMP: {
DUMP: symIndexId: 40
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 38
DUMP: lexicalParentId: 0
DUMP: name: C16B
@@ -605,7 +605,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 41
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 7
DUMP: lexicalParentId: 0
DUMP: name: Char32
@@ -628,7 +628,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 43
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 41
DUMP: lexicalParentId: 0
DUMP: name: C32A
@@ -642,7 +642,7 @@ DUMP: value: 97
DUMP: }
DUMP: {
DUMP: symIndexId: 44
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 41
DUMP: lexicalParentId: 0
DUMP: name: C32B
@@ -657,7 +657,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 45
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 7
DUMP: lexicalParentId: 0
DUMP: name: WChar
@@ -680,7 +680,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 46
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 45
DUMP: lexicalParentId: 0
DUMP: name: WCA
@@ -694,7 +694,7 @@ DUMP: value: 97
DUMP: }
DUMP: {
DUMP: symIndexId: 47
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 45
DUMP: lexicalParentId: 0
DUMP: name: WCB
@@ -709,7 +709,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 48
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 10
DUMP: lexicalParentId: 0
DUMP: name: Bool
@@ -732,7 +732,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 50
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 48
DUMP: lexicalParentId: 0
DUMP: name: BA
@@ -746,7 +746,7 @@ DUMP: value: true
DUMP: }
DUMP: {
DUMP: symIndexId: 51
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 48
DUMP: lexicalParentId: 0
DUMP: name: BB
@@ -760,7 +760,7 @@ DUMP: value: false
DUMP: }
DUMP: {
DUMP: symIndexId: 113
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 6
DUMP: lexicalParentId: 0
DUMP: name: EC
@@ -783,7 +783,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 114
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 113
DUMP: lexicalParentId: 0
DUMP: name: A
@@ -797,7 +797,7 @@ DUMP: value: 1
DUMP: }
DUMP: {
DUMP: symIndexId: 115
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 113
DUMP: lexicalParentId: 0
DUMP: name: B
@@ -812,7 +812,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 116
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 6
DUMP: lexicalParentId: 0
DUMP: name: Struct::Nested
@@ -835,7 +835,7 @@ DUMP: isValueUdt: 0
DUMP: volatileType: 0
DUMP: {
DUMP: symIndexId: 114
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 113
DUMP: lexicalParentId: 0
DUMP: name: A
@@ -849,7 +849,7 @@ DUMP: value: 1
DUMP: }
DUMP: {
DUMP: symIndexId: 115
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 113
DUMP: lexicalParentId: 0
DUMP: name: B
@@ -864,7 +864,7 @@ DUMP: }
DUMP: }
DUMP: {
DUMP: symIndexId: 117
-DUMP: symTag: 12
+DUMP: symTag: Enum
DUMP: baseType: 6
DUMP: lexicalParentId: 0
DUMP: name: EC
@@ -887,7 +887,7 @@ DUMP: unalignedType: 0
DUMP: isValueUdt: 0
DUMP: volatileType: 1 {
DUMP: symIndexId: 114
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 113
DUMP: lexicalParentId: 0
DUMP: name: A
@@ -901,7 +901,7 @@ DUMP: value: 1
DUMP: }
DUMP: {
DUMP: symIndexId: 115
-DUMP: symTag: 7
+DUMP: symTag: Data
DUMP: classParentId: 113
DUMP: lexicalParentId: 0
DUMP: name: B
Added: llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-pointers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-pointers.test?rev=342493&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-pointers.test (added)
+++ llvm/trunk/test/DebugInfo/PDB/Native/pdb-native-pointers.test Tue Sep 18 09:35:05 2018
@@ -0,0 +1,358 @@
+; Test that the native PDB reader can enumerate pointer types. The output
+; being checked against is golden output generated by llvm-pdbutil without
+; the -native flag. Then we check that we generate the same output.
+
+; RUN: llvm-pdbutil diadump -no-ids -native -pointers \
+; RUN: %p/../Inputs/every-pointer.pdb | FileCheck %s
+
+; CHECK: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 1
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 1
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 1
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 1
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 1
+; FIXME: isSingleInheritance: 1 # DIA has this property for member pointers
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 4
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 1
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; FIXME: isSingleInheritance: 1 # DIA has this property for member pointers
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 1
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; FIXME: isSingleInheritance: 1 # DIA has this property for member pointers
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 1
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 1
+; CHECK-NEXT: reference: 0
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
+; CHECK-NEXT: {
+; CHECK-NEXT: symTag: PointerType
+; CHECK-NEXT: length: 8
+; CHECK-NEXT: constType: 0
+; CHECK-NEXT: isPointerToDataMember: 0
+; CHECK-NEXT: isPointerToMemberFunction: 0
+; CHECK-NEXT: RValueReference: 0
+; CHECK-NEXT: reference: 1
+; CHECK-NEXT: restrictedType: 0
+; CHECK-NEXT: unalignedType: 0
+; CHECK-NEXT: volatileType: 0
+; CHECK-NEXT: }
\ No newline at end of file
Modified: llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp?rev=342493&r1=342492&r2=342493&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp (original)
+++ llvm/trunk/tools/llvm-pdbutil/llvm-pdbutil.cpp Tue Sep 18 09:35:05 2018
@@ -165,6 +165,20 @@ cl::list<std::string> InputFilenames(cl:
cl::opt<bool> Native("native", cl::desc("Use native PDB reader instead of DIA"),
cl::sub(DiaDumpSubcommand));
+static cl::opt<bool>
+ ShowClassHierarchy("hierarchy", cl::desc("Show lexical and class parents"),
+ cl::sub(DiaDumpSubcommand));
+static cl::opt<bool> NoSymIndexIds(
+ "no-ids",
+ cl::desc("Don't show any SymIndexId fields (overrides -hierarchy)"),
+ cl::sub(DiaDumpSubcommand));
+
+static cl::opt<bool>
+ Recurse("recurse",
+ cl::desc("When dumping a SymIndexId, dump the full details of the "
+ "corresponding record"),
+ cl::sub(DiaDumpSubcommand));
+
static cl::opt<bool> Enums("enums", cl::desc("Dump enum types"),
cl::sub(DiaDumpSubcommand));
static cl::opt<bool> Pointers("pointers", cl::desc("Dump enum types"),
@@ -965,16 +979,24 @@ static void dumpDia(StringRef Path) {
if (opts::diadump::Pointers)
SymTypes.push_back(PDB_SymType::PointerType);
+ PdbSymbolIdField Ids = opts::diadump::NoSymIndexIds ? PdbSymbolIdField::None
+ : PdbSymbolIdField::All;
+ PdbSymbolIdField Recurse = PdbSymbolIdField::None;
+ if (opts::diadump::Recurse)
+ Recurse = PdbSymbolIdField::All;
+ if (!opts::diadump::ShowClassHierarchy)
+ Ids &= ~(PdbSymbolIdField::ClassParent | PdbSymbolIdField::LexicalParent);
+
for (PDB_SymType ST : SymTypes) {
auto Children = GlobalScope->findAllChildren(ST);
while (auto Child = Children->getNext()) {
outs() << "{";
- Child->defaultDump(outs(), 2);
+ Child->defaultDump(outs(), 2, Ids, Recurse);
if (auto Enum = dyn_cast<PDBSymbolTypeEnum>(Child.get())) {
auto Enumerators = Enum->findAllChildren<PDBSymbolData>();
while (auto Enumerator = Enumerators->getNext()) {
outs() << " {";
- Enumerator->defaultDump(outs(), 4);
+ Enumerator->defaultDump(outs(), 4, Ids, Recurse);
outs() << "\n }\n";
}
}
More information about the llvm-commits
mailing list