31 Variant VariantFromVARIANT(
const VARIANT &V) {
67 Result.
Value.
Bool = (V.boolVal == VARIANT_TRUE) ?
true :
false;
79 const char *SrcBytes =
reinterpret_cast<const char *
>(V.bstrVal);
84 Result.
Value.
String =
new char[Result8.length() + 1];
96 template <
typename ArgType>
98 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
100 if (S_OK == (Symbol->*Method)(&Value))
101 return static_cast<ArgType
>(Value);
106 template <
typename ArgType,
typename RetType>
108 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
110 if (S_OK == (Symbol->*Method)(&Value))
111 return static_cast<RetType
>(Value);
118 HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
124 HRESULT (__stdcall IDiaSymbol::*Method)(GUID *)) {
126 if (S_OK != (Symbol->*Method)(&Result))
130 "GUID is the wrong size!");
132 ::memcpy(&IdResult, &Result,
sizeof(GUID));
136 template <
typename Pr
intType,
typename ArgType>
139 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
141 if (S_OK == (Symbol->*Method)(&Value))
147 HRESULT (__stdcall IDiaSymbol::*Method)(
DWORD *),
151 if (S_OK == (Symbol->*Method)(&Value))
156 template <
typename ArgType>
159 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
161 if (S_OK == (Symbol->*Method)(&Value))
167 HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
168 BSTR Value =
nullptr;
169 if (S_OK != (Symbol->*Method)(&Value))
171 const char *Bytes =
reinterpret_cast<const char *
>(Value);
176 ::SysFreeString(Value);
181 HRESULT (__stdcall IDiaSymbol::*Method)(VARIANT *)) {
184 if (S_OK != (Symbol->*Method)(&Value))
186 Variant V = VariantFromVARIANT(Value);
194 StringRef GuidBytes(reinterpret_cast<const char *>(&G),
sizeof(G));
202 CComPtr<IDiaSymbol> DiaSymbol)
203 : Session(PDBSession), Symbol(DiaSymbol) {}
205 #define RAW_ID_METHOD_DUMP(Stream, Method, Session, FieldId, ShowFlags, \ 207 DumpDIAIdValue(Stream, Indent, StringRef{#Method}, Symbol, \ 208 &IDiaSymbol::get_##Method, Session, FieldId, ShowFlags, \ 211 #define RAW_METHOD_DUMP(Stream, Method) \ 212 DumpDIAValue(Stream, Indent, StringRef{#Method}, Symbol, \ 213 &IDiaSymbol::get_##Method); 215 #define RAW_METHOD_DUMP_AS(Stream, Method, Type) \ 216 DumpDIAValueAs<Type>(Stream, Indent, StringRef{#Method}, Symbol, \ 217 &IDiaSymbol::get_##Method); 223 ShowIdFields, RecurseIdFields);
242 ShowIdFields, RecurseIdFields);
398 std::unique_ptr<IPDBEnumSymbols>
400 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
402 CComPtr<IDiaEnumSymbols> DiaEnumerator;
404 Symbol->findChildrenEx(EnumVal,
nullptr, nsNone, &DiaEnumerator)) {
405 if (S_OK != Symbol->findChildren(EnumVal,
nullptr, nsNone, &DiaEnumerator))
409 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
412 std::unique_ptr<IPDBEnumSymbols>
418 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
419 DWORD CompareFlags =
static_cast<DWORD>(Flags);
420 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
422 CComPtr<IDiaEnumSymbols> DiaEnumerator;
424 Symbol->findChildrenEx(EnumVal, Name16Str, CompareFlags, &DiaEnumerator))
427 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
430 std::unique_ptr<IPDBEnumSymbols>
437 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
439 DWORD CompareFlags =
static_cast<DWORD>(Flags);
440 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
442 CComPtr<IDiaEnumSymbols> DiaEnumerator;
443 if (S_OK != Symbol->findChildrenExByAddr(EnumVal, Name16Str, CompareFlags,
444 Section, Offset, &DiaEnumerator))
447 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
450 std::unique_ptr<IPDBEnumSymbols>
456 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
458 DWORD CompareFlags =
static_cast<DWORD>(Flags);
459 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
461 CComPtr<IDiaEnumSymbols> DiaEnumerator;
462 if (S_OK != Symbol->findChildrenExByVA(EnumVal, Name16Str, CompareFlags, VA,
466 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
469 std::unique_ptr<IPDBEnumSymbols>
475 enum SymTagEnum EnumVal =
static_cast<enum SymTagEnum
>(
Type);
476 DWORD CompareFlags =
static_cast<DWORD>(Flags);
477 wchar_t *Name16Str =
reinterpret_cast<wchar_t *
>(Name16.
data());
479 CComPtr<IDiaEnumSymbols> DiaEnumerator;
480 if (S_OK != Symbol->findChildrenExByRVA(EnumVal, Name16Str, CompareFlags, RVA,
484 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
487 std::unique_ptr<IPDBEnumSymbols>
489 CComPtr<IDiaEnumSymbols> DiaEnumerator;
490 if (S_OK != Symbol->findInlineFramesByAddr(Section, Offset, &DiaEnumerator))
493 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
496 std::unique_ptr<IPDBEnumSymbols>
498 CComPtr<IDiaEnumSymbols> DiaEnumerator;
499 if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator))
502 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
505 std::unique_ptr<IPDBEnumSymbols>
507 CComPtr<IDiaEnumSymbols> DiaEnumerator;
508 if (S_OK != Symbol->findInlineFramesByVA(VA, &DiaEnumerator))
511 return llvm::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
515 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
516 if (S_OK != Symbol->findInlineeLines(&DiaEnumerator))
519 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
522 std::unique_ptr<IPDBEnumLineNumbers>
525 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
527 Symbol->findInlineeLinesByAddr(Section, Offset, Length, &DiaEnumerator))
530 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
533 std::unique_ptr<IPDBEnumLineNumbers>
535 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
536 if (S_OK != Symbol->findInlineeLinesByRVA(RVA, Length, &DiaEnumerator))
539 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
542 std::unique_ptr<IPDBEnumLineNumbers>
544 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
545 if (S_OK != Symbol->findInlineeLinesByVA(VA, Length, &DiaEnumerator))
548 return llvm::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
555 Symbol->get_dataBytes(0, &DataSize,
nullptr);
560 Symbol->get_dataBytes(DataSize, &DataSize, bytes.
data());
565 if (S_OK != Symbol->get_undecoratedNameEx((
DWORD)Flags, &Result16))
566 return std::string();
568 const char *SrcBytes =
reinterpret_cast<const char *
>(Result16.m_str);
572 return std::string();
577 return PrivateGetDIAValue<DWORD, PDB_MemberAccess>(Symbol,
578 &IDiaSymbol::get_access);
617 return PrivateGetDIAValue<DWORD, PDB_BuiltinType>(Symbol,
618 &IDiaSymbol::get_baseType);
626 return PrivateGetDIAValue<DWORD, PDB_CallingConv>(
627 Symbol, &IDiaSymbol::get_callingConvention);
654 return PrivateGetDIAValue<DWORD, PDB_Lang>(Symbol, &IDiaSymbol::get_language);
667 &IDiaSymbol::get_liveRangeStartAddressOffset);
672 &IDiaSymbol::get_liveRangeStartAddressSection);
677 Symbol, &IDiaSymbol::get_liveRangeStartRelativeVirtualAddress);
681 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
682 Symbol, &IDiaSymbol::get_localBasePointerRegisterId);
699 &IDiaSymbol::get_numberOfAcceleratorPointerTags);
735 return PrivateGetDIAValue<DWORD, PDB_Cpu>(Symbol, &IDiaSymbol::get_platform);
743 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
744 Symbol, &IDiaSymbol::get_registerId);
776 CComPtr<IDiaLineNumber> LineNumber;
777 if (FAILED(Symbol->getSrcLineOnTypeDefn(&LineNumber)) || !LineNumber)
780 return llvm::make_unique<DIALineNumber>(LineNumber);
805 &IDiaSymbol::get_targetRelativeVirtualAddress);
851 if (S_OK != Symbol->get_value(&Value))
854 return VariantFromVARIANT(Value);
869 std::unique_ptr<PDBSymbolTypeBuiltin>
871 CComPtr<IDiaSymbol> TableType;
872 if (FAILED(Symbol->get_virtualBaseTableType(&TableType)) || !TableType)
875 auto RawVT = llvm::make_unique<DIARawSymbol>(Session, TableType);
877 PDBSymbol::createAs<PDBSymbolTypePointer>(Session, std::move(RawVT));
882 return PrivateGetDIAValue<DWORD, PDB_DataKind>(Symbol,
883 &IDiaSymbol::get_dataKind);
887 return PrivateGetDIAValue<DWORD, PDB_SymType>(Symbol,
888 &IDiaSymbol::get_symTag);
908 return PrivateGetDIAValue<DWORD, PDB_LocType>(Symbol,
909 &IDiaSymbol::get_locationType);
913 return PrivateGetDIAValue<DWORD, PDB_Machine>(Symbol,
914 &IDiaSymbol::get_machineType);
918 return PrivateGetDIAValue<DWORD, codeview::ThunkOrdinal>(
919 Symbol, &IDiaSymbol::get_thunkOrdinal);
935 return PrivateGetDIAValue<DWORD, PDB_UdtType>(Symbol,
936 &IDiaSymbol::get_udtKind);
1069 &IDiaSymbol::get_isAcceleratorGroupSharedLocal);
1074 &IDiaSymbol::get_isAcceleratorPointerTagLiveRange);
1131 &IDiaSymbol::get_isLocationControlFlowDependent);
1172 &IDiaSymbol::get_isPointerBasedOnSymbolValue);
bool hasAlloca() const override
bool hasInlineAttribute() const override
bool hasNoReturnAttribute() const override
uint32_t getToken() const override
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
uint32_t getLiveRangeStartRelativeVirtualAddress() const override
bool hasInterruptReturn() const override
bool isRValueReference() const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByVA(uint64_t VA) const override
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const override
PDB_UdtType getUdtKind() const override
This class represents lattice values for constants.
int32_t getOffset() const override
void dump(raw_ostream &OS, int Indent, PdbSymbolIdField ShowIdFields, PdbSymbolIdField RecurseIdFields) const override
bool isStatic() const override
codeview::RegisterId getLocalBasePointerRegisterId() const override
uint32_t getNumberOfColumns() const override
uint32_t getTargetOffset() const override
LLVM_NODISCARD auto unique_dyn_cast(std::unique_ptr< Y > &Val) -> decltype(cast< X >(Val))
bool hasOptimizedCodeDebugInfo() const override
SymIndexId getClassParentId() const override
#define RAW_ID_METHOD_DUMP(Stream, Method, Session, FieldId, ShowFlags, RecurseFlags)
PDB_UdtType
These values correspond to the UdtKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx.
uint32_t getTextureSlot() const override
#define RAW_METHOD_DUMP_AS(Stream, Method, Type)
bool isNaked() const override
uint32_t getVirtualBaseDispIndex() const override
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
bool isValueUdt() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByAddr(uint32_t Section, uint32_t Offset, uint32_t Length) const override
SymIndexId getBaseSymbolId() const override
SymIndexId getOemSymbolId() const override
std::string getUnused() const override
bool isConstructorVirtualBase() const override
bool getNoStackOrdering() const override
bool isPureVirtual() const override
bool isSdl() const override
SymIndexId getVirtualTableShapeId() const override
std::string getSymbolsFileName() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByVA(uint64_t VA, uint32_t Length) const override
bool isFunction() const override
bool isReturnValue() const override
PDB_Machine getMachineType() const override
bool isRefUdt() const override
bool hasManagedCode() const override
bool isVirtual() const override
bool hasOverloadedOperator() const override
raw_ostream & operator<<(raw_ostream &OS, const PDB_VariantType &Value)
bool hasCastOperator() const override
amdgpu Simplify well known AMD library false Value Value const Twine & Name
uint32_t getStride() const override
bool hasEHa() const override
bool isIntroVirtualFunction() const override
uint32_t getNumberOfRegisterIndices() const override
std::string getName() const override
codeview::ThunkOrdinal getThunkOrdinal() const override
void format(raw_ostream &Stream, StringRef Style) override
SymIndexId getUnmodifiedTypeId() const override
This represents the 'GUID' type from windows.h.
bool isScoped() const override
SymIndexId getLowerBoundId() const override
std::unique_ptr< IPDBLineNumber > getSrcLineOnTypeDefn() const override
std::string getUndecoratedNameEx(PDB_UndnameFlags Flags) const override
bool isCxxReturnUdt() const override
bool isVolatileType() const override
uint32_t getNumberOfAcceleratorPointerTags() const override
SymIndexId getUpperBoundId() const override
PDB_SymType getSymTag() const override
bool isNested() const override
bool isMSILNetmodule() const override
bool isPointerToMemberFunction() const override
uint64_t getLength() const override
SymIndexId getSymIndexId() const override
bool isOptimizedAway() const override
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
bool isIndirectVirtualBaseClass() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint64_t VA) const override
uint32_t getTimeStamp() const override
bool isIntrinsic() const override
PDB_UndnameFlags
These values correspond to the flags that can be combined to control the return of an undecorated nam...
bool convertUTF8ToUTF16String(StringRef SrcUTF8, SmallVectorImpl< UTF16 > &DstUTF16)
Converts a UTF-8 string into a UTF-16 string with native endianness.
void getFrontEndVersion(VersionInfo &Version) const override
PDB_BuiltinType getBuiltinType() const override
bool hasCustomCallingConvention() const override
uint32_t getLiveRangeStartAddressOffset() const override
bool isLocationControlFlowDependent() const override
bool isAcceleratorPointerTagLiveRange() const override
auto count(R &&Range, const E &Element) -> typename std::iterator_traits< decltype(adl_begin(Range))>::difference_type
Wrapper function around std::count to count the number of times an element Element occurs in the give...
bool isRestrictedType() const override
bool hasCTypes() const override
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
uint32_t getRank() const override
PDB_MemberAccess getAccess() const override
bool getAddressTaken() const override
uint32_t getTargetSection() const override
ArgType PrivateGetDIAValue(IDiaFrameData *FrameData, HRESULT(__stdcall IDiaFrameData::*Method)(ArgType *))
uint32_t getRegisterType() const override
bool isAcceleratorGroupSharedLocal() const override
bool isEditAndContinueEnabled() const override
The instances of the Type class are immutable: once they are created, they are never changed...
PDB_DataKind
These values correspond to the DataKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx.
void getDataBytes(llvm::SmallVector< uint8_t, 32 > &bytes) const override
bool isPointerBasedOnSymbolValue() const override
uint32_t getOffsetInUdt() const override
bool isAcceleratorStubFunction() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByAddr(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t Section, uint32_t Offset) const override
void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent)
bool isDataAligned() const override
uint64_t getTargetVirtualAddress() const override
bool hasNestedTypes() const override
codeview::GUID getGuid() const override
SymIndexId getLexicalParentId() const override
void dumpSymbolIdField(raw_ostream &OS, StringRef Name, SymIndexId Value, int Indent, const IPDBSession &Session, PdbSymbolIdField FieldId, PdbSymbolIdField ShowFlags, PdbSymbolIdField RecurseFlags)
bool isVirtualBaseClass() const override
bool hasEH() const override
bool wasInlined() const override
bool isAggregated() const override
bool isMSILCode() const override
uint32_t getSizeInUdt() const override
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn...
uint32_t getTargetRelativeVirtualAddress() const override
bool isPacked() const override
PDB_CallingConv getCallingConvention() const override
std::string getCompilerName() const override
uint64_t getLiveRangeLength() const override
bool isConstType() const override
bool isCode() const override
uint32_t getSignature() const override
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx.
bool hasSEH() const override
std::string invokeBstrMethod(Obj &Object, HRESULT(__stdcall Obj::*Func)(BSTR *))
union llvm::pdb::Variant::@215 Value
std::unique_ptr< IPDBEnumSymbols > findInlineFramesByRVA(uint32_t RVA) const override
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool isCVTCIL() const override
int32_t getVirtualBasePointerOffset() const override
bool isManagedCode() const override
bool hasPrivateSymbols() const override
bool isSafeBuffers() const override
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
int32_t getThisAdjust() const override
std::string getLibraryName() const override
codeview::RegisterId getRegisterId() const override
bool isMatrixRowMajor() const override
bool isHLSLData() const override
uint32_t getSlot() const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const override
SymIndexId getArrayIndexTypeId() const override
bool hasLongJump() const override
bool hasAssignmentOperator() const override
uint32_t getVirtualBaseOffset() const override
DIARawSymbol(const DIASession &PDBSession, CComPtr< IDiaSymbol > DiaSymbol)
std::string getSourceFileName() const override
uint32_t getBaseDataOffset() const override
SymIndexId getTypeId() const override
bool convertUTF16ToUTF8String(ArrayRef< char > SrcBytes, std::string &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
bool hasSetJump() const override
bool isVirtualInheritance() const override
bool isUnreached() const override
SymIndexId getSubTypeId() const override
bool isPointerToDataMember() const override
uint32_t getNumberOfModifiers() const override
PDB_LocType getLocationType() const override
bool hasStrictGSCheck() const override
pointer data()
Return a pointer to the vector's buffer, even if empty().
bool hasSecurityChecks() const override
void getBackEndVersion(VersionInfo &Version) const override
std::unique_ptr< IPDBEnumLineNumbers > findInlineeLines() const override
bool hasFramePointer() const override
#define RAW_METHOD_DUMP(Stream, Method)
uint32_t getNumberOfRows() const override
std::string getUndecoratedName() const override
uint32_t getAddressSection() const override
uint32_t getAge() const override
PDB_Cpu getPlatform() const override
uint32_t getOemId() const override
bool isHotpatchable() const override
bool isMultipleInheritance() const override
ThunkOrdinal
These values correspond to the THUNK_ORDINAL enumeration.
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx.
std::unique_ptr< IPDBEnumSymbols > findChildren(PDB_SymType Type) const override
bool hasNoInlineAttribute() const override
bool isLTCG() const override
uint32_t getCount() const override
LLVM Value Representation.
bool isSplitted() const override
uint64_t getVirtualAddress() const override
std::unique_ptr< IPDBEnumSymbols > findChildrenByRVA(PDB_SymType Type, StringRef Name, PDB_NameSearchFlags Flags, uint32_t RVA) const override
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
uint32_t getMemorySpaceKind() const override
This class implements an extremely fast bulk output stream that can only output to a stream...
bool isCompilerGenerated() const override
std::error_code access(const Twine &Path, AccessMode Mode)
Can the file be accessed?
StringRef - Represent a constant reference to a string, i.e.
Variant getValue() const override
bool isSingleInheritance() const override
uint32_t getLiveRangeStartAddressSection() const override
PDB_Lang getLanguage() const override
std::string getObjectFileName() const override
bool isInterfaceUdt() const override
Utility type to build an inheritance chain that makes it easy to rank overload candidates.
bool isReference() const override
PDB_DataKind getDataKind() const override
bool hasInlAsm() const override
uint32_t getAddressOffset() const override
uint32_t getUavSlot() const override
uint32_t getBitPosition() const override
uint32_t getBaseDataSlot() const override
bool hasConstructor() const override
bool isUnalignedType() const override
uint32_t getCountLiveRanges() const override
uint32_t getSamplerSlot() const override
std::unique_ptr< PDBSymbolTypeBuiltin > getVirtualBaseTableType() const override
bool hasDebugInfo() const override
bool hasFarReturn() const override
uint32_t getRelativeVirtualAddress() const override