Index: include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h =================================================================== --- include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h +++ include/llvm/DebugInfo/PDB/DIA/DIARawSymbol.h @@ -96,7 +96,7 @@ uint32_t getTypeId() const override; uint32_t getUavSlot() const override; std::string getUndecoratedName() const override; - std::string getUndecoratedNameEx(uint32_t Options) const override; + std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const override; uint32_t getUnmodifiedTypeId() const override; uint32_t getUpperBoundId() const override; Variant getValue() const override; Index: include/llvm/DebugInfo/PDB/DIA/DIASession.h =================================================================== --- include/llvm/DebugInfo/PDB/DIA/DIASession.h +++ include/llvm/DebugInfo/PDB/DIA/DIASession.h @@ -64,7 +64,7 @@ std::unique_ptr getDebugStreams() const override; - std::unique_ptr getTables() const override; + std::unique_ptr getEnumTables() const override; private: CComPtr Session; }; Index: include/llvm/DebugInfo/PDB/IPDBRawSymbol.h =================================================================== --- include/llvm/DebugInfo/PDB/IPDBRawSymbol.h +++ include/llvm/DebugInfo/PDB/IPDBRawSymbol.h @@ -108,7 +108,7 @@ virtual uint32_t getTypeId() const = 0; virtual uint32_t getUavSlot() const = 0; virtual std::string getUndecoratedName() const = 0; - virtual std::string getUndecoratedNameEx(uint32_t Options) const = 0; + virtual std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const = 0; virtual uint32_t getUnmodifiedTypeId() const = 0; virtual uint32_t getUpperBoundId() const = 0; virtual Variant getValue() const = 0; Index: include/llvm/DebugInfo/PDB/IPDBSession.h =================================================================== --- include/llvm/DebugInfo/PDB/IPDBSession.h +++ include/llvm/DebugInfo/PDB/IPDBSession.h @@ -68,7 +68,7 @@ virtual std::unique_ptr getDebugStreams() const = 0; - virtual std::unique_ptr getTables() const = 0; + virtual std::unique_ptr getEnumTables() const = 0; }; } } Index: include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h =================================================================== --- include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h +++ include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h @@ -101,7 +101,7 @@ uint32_t getTypeId() const override; uint32_t getUavSlot() const override; std::string getUndecoratedName() const override; - std::string getUndecoratedNameEx(uint32_t Options) const override; + std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const override; uint32_t getUnmodifiedTypeId() const override; uint32_t getUpperBoundId() const override; Variant getValue() const override; Index: include/llvm/DebugInfo/PDB/Native/NativeSession.h =================================================================== --- include/llvm/DebugInfo/PDB/Native/NativeSession.h +++ include/llvm/DebugInfo/PDB/Native/NativeSession.h @@ -82,7 +82,7 @@ std::unique_ptr getDebugStreams() const override; - std::unique_ptr getTables() const override; + std::unique_ptr getEnumTables() const override; PDBFile &getPDBFile() { return *Pdb; } const PDBFile &getPDBFile() const { return *Pdb; } Index: include/llvm/DebugInfo/PDB/PDBTypes.h =================================================================== --- include/llvm/DebugInfo/PDB/PDBTypes.h +++ include/llvm/DebugInfo/PDB/PDBTypes.h @@ -74,7 +74,7 @@ /// An enumeration indicating the type of data contained in this table. enum class PDB_TableType { - TableInvalid, + TableInvalid = 0, Symbols, SourceFiles, LineNumbers, @@ -246,27 +246,31 @@ HResult = 31 }; -// https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx -#define UND_COMPLETE 0x0 -#define UND_NO_LEADING_UNDERSCORES 0x1 -#define UND_NO_MS_KEYWORDS 0x2 -#define UND_NO_FUNC_RETURN 0x4 -#define UND_NO_ALLOC_MODEL 0x8 -#define UND_NO_ALLOC_LANG 0x10 -#define UND_RES1 0x20 -#define UND_RES2 0x40 -#define UND_NO_THISTYPE 0x60 -#define UND_NO_ACCESS_SPEC 0x80 -#define UND_NO_THROW_SIG 0x100 -#define UND_NO_MEMBER_TYPE 0x200 -#define UND_NO_RETURN_UDT 0x400 -#define UND_32_BIT_DECODE 0x800 -#define UND_NAME_ONLY 0x1000 -#define UND_TYPE_ONLY 0x2000 -#define UND_HAVE_PARAM 0x4000 -#define UND_NO_ESCU 0x8000 -#define UND_NO_INDENT_CHAR_CHECK 0x10000 -#define UND_NO_PTR64 0x20000 +/// These values correspond to the flags that can be combined to control +/// return of undecorated name for a C++ decorated name, and are documented +/// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx +enum PDB_UndnameFlags: uint32_t { + Undname_Complete = 0x0, + Undname_NoLeadingUnderscores = 0x1, + Undname_NoMsKeywords = 0x2, + Undname_NoFuncReturns = 0x4, + Undname_NoAllocModel = 0x8, + Undname_NoAllocLang = 0x10, + Undname_Reserved1 = 0x20, + Undname_Reserved2 = 0x40, + Undname_NoThisType = 0x60, + Undname_NoAccessSpec = 0x80, + Undname_NoThrowSig = 0x100, + Undname_NoMemberType = 0x200, + Undname_NoReturnUDTModel = 0x400, + Undname_32BitDecode = 0x800, + Undname_NameOnly = 0x1000, + Undname_TypeOnly = 0x2000, + Undname_HaveParams = 0x4000, + Undname_NoECSU = 0x8000, + Undname_NoIdentCharCheck = 0x10000, + Undname_NoPTR64 = 0x20000 +}; enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 }; Index: lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp =================================================================== --- lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp +++ lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp @@ -440,9 +440,9 @@ } std::string -DIARawSymbol::getUndecoratedNameEx(uint32_t Options) const { +DIARawSymbol::getUndecoratedNameEx(PDB_UndnameFlags Flags) const { CComBSTR Result16; - if (S_OK != Symbol->get_undecoratedNameEx((DWORD)Options, &Result16)) + if (S_OK != Symbol->get_undecoratedNameEx((DWORD)Flags, &Result16)) return std::string(); const char *SrcBytes = reinterpret_cast(Result16.m_str); Index: lib/DebugInfo/PDB/DIA/DIASession.cpp =================================================================== --- lib/DebugInfo/PDB/DIA/DIASession.cpp +++ lib/DebugInfo/PDB/DIA/DIASession.cpp @@ -303,7 +303,7 @@ return llvm::make_unique(DiaEnumerator); } -std::unique_ptr DIASession::getTables() const { +std::unique_ptr DIASession::getEnumTables() const { CComPtr DiaEnumerator; if (S_OK != Session->getEnumTables(&DiaEnumerator)) return nullptr; Index: lib/DebugInfo/PDB/DIA/DIATable.cpp =================================================================== --- lib/DebugInfo/PDB/DIA/DIATable.cpp +++ lib/DebugInfo/PDB/DIA/DIATable.cpp @@ -37,25 +37,25 @@ PDB_TableType DIATable::getTableType() const { CComBSTR Name16; - if (S_OK == Table->get_name(&Name16)) { - if (Name16 == DiaTable_Symbols) - return PDB_TableType::Symbols; - else if (Name16 == DiaTable_SrcFiles) - return PDB_TableType::SourceFiles; - else if (Name16 == DiaTable_Sections) - return PDB_TableType::SectionContribs; - else if (Name16 == DiaTable_LineNums) - return PDB_TableType::LineNumbers; - else if (Name16 == DiaTable_SegMap) - return PDB_TableType::Segments; - else if (Name16 == DiaTable_InjSrc) - return PDB_TableType::InjectedSources; - else if (Name16 == DiaTable_FrameData) - return PDB_TableType::FrameData; - else if (Name16 == DiaTable_InputAssemblyFiles) - return PDB_TableType::InputAssemblyFiles; - else if (Name16 == DiaTable_Dbg) - return PDB_TableType::Dbg; - } - return PDB_TableType::TableInvalid; + if (S_OK != Table->get_name(&Name16)) + return PDB_TableType::TableInvalid; + + if (Name16 == DiaTable_Symbols) + return PDB_TableType::Symbols; + if (Name16 == DiaTable_SrcFiles) + return PDB_TableType::SourceFiles; + if (Name16 == DiaTable_Sections) + return PDB_TableType::SectionContribs; + if (Name16 == DiaTable_LineNums) + return PDB_TableType::LineNumbers; + if (Name16 == DiaTable_SegMap) + return PDB_TableType::Segments; + if (Name16 == DiaTable_InjSrc) + return PDB_TableType::InjectedSources; + if (Name16 == DiaTable_FrameData) + return PDB_TableType::FrameData; + if (Name16 == DiaTable_InputAssemblyFiles) + return PDB_TableType::InputAssemblyFiles; + if (Name16 == DiaTable_Dbg) + return PDB_TableType::Dbg; } Index: lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp =================================================================== --- lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp +++ lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp @@ -286,7 +286,8 @@ return {}; } -std::string NativeRawSymbol::getUndecoratedNameEx(uint32_t Options) const { +std::string NativeRawSymbol::getUndecoratedNameEx( + PDB_UndnameFlags Flags) const { return {}; } Index: lib/DebugInfo/PDB/Native/NativeSession.cpp =================================================================== --- lib/DebugInfo/PDB/Native/NativeSession.cpp +++ lib/DebugInfo/PDB/Native/NativeSession.cpp @@ -252,6 +252,6 @@ return nullptr; } -std::unique_ptr NativeSession::getTables() const { +std::unique_ptr NativeSession::getEnumTables() const { return nullptr; } Index: unittests/DebugInfo/PDB/PDBApiTest.cpp =================================================================== --- unittests/DebugInfo/PDB/PDBApiTest.cpp +++ unittests/DebugInfo/PDB/PDBApiTest.cpp @@ -14,6 +14,7 @@ #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h" #include "llvm/DebugInfo/PDB/IPDBSession.h" #include "llvm/DebugInfo/PDB/IPDBSourceFile.h" +#include "llvm/DebugInfo/PDB/IPDBTable.h" #include "llvm/DebugInfo/PDB/PDBSymbol.h" #include "llvm/DebugInfo/PDB/PDBSymbolAnnotation.h" @@ -118,6 +119,10 @@ std::unique_ptr getDebugStreams() const override { return nullptr; } + + std::unique_ptr getEnumTables() const override { + return nullptr; + } }; class MockRawSymbol : public IPDBRawSymbol { @@ -152,6 +157,10 @@ PDB_SymType getSymTag() const override { return Type; } + std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const override { + return {}; + } + MOCK_SYMBOL_ACCESSOR(getAccess) MOCK_SYMBOL_ACCESSOR(getAddressOffset) MOCK_SYMBOL_ACCESSOR(getAddressSection)