1 //===- DIARawSymbol.cpp - DIA implementation of IPDBRawSymbol ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/DebugInfo/PDB/DIA/DIARawSymbol.h"
10 #include "llvm/ADT/ArrayRef.h"
11 #include "llvm/ADT/STLExtras.h"
12 #include "llvm/DebugInfo/CodeView/Formatters.h"
13 #include "llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h"
14 #include "llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h"
15 #include "llvm/DebugInfo/PDB/DIA/DIALineNumber.h"
16 #include "llvm/DebugInfo/PDB/DIA/DIASession.h"
17 #include "llvm/DebugInfo/PDB/DIA/DIAUtils.h"
18 #include "llvm/DebugInfo/PDB/PDBExtras.h"
19 #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
20 #include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
21 #include "llvm/DebugInfo/PDB/PDBSymbolTypeVTable.h"
22 #include "llvm/DebugInfo/PDB/PDBSymbolTypeVTableShape.h"
23 #include "llvm/Support/ConvertUTF.h"
24 #include "llvm/Support/raw_ostream.h"
25
26 using namespace llvm;
27 using namespace llvm::pdb;
28
29 namespace {
VariantFromVARIANT(const VARIANT & V)30 Variant VariantFromVARIANT(const VARIANT &V) {
31 Variant Result;
32 switch (V.vt) {
33 case VT_I1:
34 Result.Value.Int8 = V.cVal;
35 Result.Type = PDB_VariantType::Int8;
36 break;
37 case VT_I2:
38 Result.Value.Int16 = V.iVal;
39 Result.Type = PDB_VariantType::Int16;
40 break;
41 case VT_I4:
42 Result.Value.Int32 = V.intVal;
43 Result.Type = PDB_VariantType::Int32;
44 break;
45 case VT_I8:
46 Result.Value.Int64 = V.llVal;
47 Result.Type = PDB_VariantType::Int64;
48 break;
49 case VT_UI1:
50 Result.Value.UInt8 = V.bVal;
51 Result.Type = PDB_VariantType::UInt8;
52 break;
53 case VT_UI2:
54 Result.Value.UInt16 = V.uiVal;
55 Result.Type = PDB_VariantType::UInt16;
56 break;
57 case VT_UI4:
58 Result.Value.UInt32 = V.uintVal;
59 Result.Type = PDB_VariantType::UInt32;
60 break;
61 case VT_UI8:
62 Result.Value.UInt64 = V.ullVal;
63 Result.Type = PDB_VariantType::UInt64;
64 break;
65 case VT_BOOL:
66 Result.Value.Bool = (V.boolVal == VARIANT_TRUE) ? true : false;
67 Result.Type = PDB_VariantType::Bool;
68 break;
69 case VT_R4:
70 Result.Value.Single = V.fltVal;
71 Result.Type = PDB_VariantType::Single;
72 break;
73 case VT_R8:
74 Result.Value.Double = V.dblVal;
75 Result.Type = PDB_VariantType::Double;
76 break;
77 case VT_BSTR: {
78 const char *SrcBytes = reinterpret_cast<const char *>(V.bstrVal);
79 llvm::ArrayRef<char> SrcByteArray(SrcBytes, SysStringByteLen(V.bstrVal));
80 std::string Result8;
81 if (!llvm::convertUTF16ToUTF8String(SrcByteArray, Result8))
82 Result.Value.String = nullptr;
83 Result.Value.String = new char[Result8.length() + 1];
84 ::strcpy(Result.Value.String, Result8.c_str());
85 Result.Type = PDB_VariantType::String;
86 break;
87 }
88 default:
89 Result.Type = PDB_VariantType::Unknown;
90 break;
91 }
92 return Result;
93 }
94
95 template <typename ArgType>
PrivateGetDIAValue(IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(ArgType *))96 ArgType PrivateGetDIAValue(IDiaSymbol *Symbol,
97 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
98 ArgType Value;
99 if (S_OK == (Symbol->*Method)(&Value))
100 return static_cast<ArgType>(Value);
101
102 return ArgType();
103 }
104
105 template <typename ArgType, typename RetType>
PrivateGetDIAValue(IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(ArgType *))106 RetType PrivateGetDIAValue(IDiaSymbol *Symbol,
107 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
108 ArgType Value;
109 if (S_OK == (Symbol->*Method)(&Value))
110 return static_cast<RetType>(Value);
111
112 return RetType();
113 }
114
115 std::string
PrivateGetDIAValue(IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(BSTR *))116 PrivateGetDIAValue(IDiaSymbol *Symbol,
117 HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
118 return invokeBstrMethod(*Symbol, Method);
119 }
120
121 codeview::GUID
PrivateGetDIAValue(IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(GUID *))122 PrivateGetDIAValue(IDiaSymbol *Symbol,
123 HRESULT (__stdcall IDiaSymbol::*Method)(GUID *)) {
124 GUID Result;
125 if (S_OK != (Symbol->*Method)(&Result))
126 return codeview::GUID();
127
128 static_assert(sizeof(codeview::GUID) == sizeof(GUID),
129 "GUID is the wrong size!");
130 codeview::GUID IdResult;
131 ::memcpy(&IdResult, &Result, sizeof(GUID));
132 return IdResult;
133 }
134
135 template <typename PrintType, typename ArgType>
DumpDIAValueAs(llvm::raw_ostream & OS,int Indent,StringRef Name,IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(ArgType *))136 void DumpDIAValueAs(llvm::raw_ostream &OS, int Indent, StringRef Name,
137 IDiaSymbol *Symbol,
138 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
139 ArgType Value;
140 if (S_OK == (Symbol->*Method)(&Value))
141 dumpSymbolField(OS, Name, static_cast<PrintType>(Value), Indent);
142 }
143
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)144 void DumpDIAIdValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
145 IDiaSymbol *Symbol,
146 HRESULT (__stdcall IDiaSymbol::*Method)(DWORD *),
147 const IPDBSession &Session, PdbSymbolIdField FieldId,
148 PdbSymbolIdField ShowFlags, PdbSymbolIdField RecurseFlags) {
149 DWORD Value;
150 if (S_OK == (Symbol->*Method)(&Value))
151 dumpSymbolIdField(OS, Name, Value, Indent, Session, FieldId, ShowFlags,
152 RecurseFlags);
153 }
154
155 template <typename ArgType>
DumpDIAValue(llvm::raw_ostream & OS,int Indent,StringRef Name,IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(ArgType *))156 void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
157 IDiaSymbol *Symbol,
158 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
159 ArgType Value;
160 if (S_OK == (Symbol->*Method)(&Value))
161 dumpSymbolField(OS, Name, Value, Indent);
162 }
163
DumpDIAValue(llvm::raw_ostream & OS,int Indent,StringRef Name,IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(BSTR *))164 void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
165 IDiaSymbol *Symbol,
166 HRESULT (__stdcall IDiaSymbol::*Method)(BSTR *)) {
167 BSTR Value = nullptr;
168 if (S_OK != (Symbol->*Method)(&Value))
169 return;
170 const char *Bytes = reinterpret_cast<const char *>(Value);
171 ArrayRef<char> ByteArray(Bytes, ::SysStringByteLen(Value));
172 std::string Result;
173 if (llvm::convertUTF16ToUTF8String(ByteArray, Result))
174 dumpSymbolField(OS, Name, Result, Indent);
175 ::SysFreeString(Value);
176 }
177
DumpDIAValue(llvm::raw_ostream & OS,int Indent,StringRef Name,IDiaSymbol * Symbol,HRESULT (__stdcall IDiaSymbol::* Method)(VARIANT *))178 void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
179 IDiaSymbol *Symbol,
180 HRESULT (__stdcall IDiaSymbol::*Method)(VARIANT *)) {
181 VARIANT Value;
182 Value.vt = VT_EMPTY;
183 if (S_OK != (Symbol->*Method)(&Value))
184 return;
185 Variant V = VariantFromVARIANT(Value);
186
187 dumpSymbolField(OS, Name, V, Indent);
188 }
189 } // namespace
190
191 namespace llvm {
operator <<(llvm::raw_ostream & OS,const GUID & G)192 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const GUID &G) {
193 StringRef GuidBytes(reinterpret_cast<const char *>(&G), sizeof(G));
194 codeview::detail::GuidAdapter A(GuidBytes);
195 A.format(OS, "");
196 return OS;
197 }
198 } // namespace llvm
199
DIARawSymbol(const DIASession & PDBSession,CComPtr<IDiaSymbol> DiaSymbol)200 DIARawSymbol::DIARawSymbol(const DIASession &PDBSession,
201 CComPtr<IDiaSymbol> DiaSymbol)
202 : Session(PDBSession), Symbol(DiaSymbol) {}
203
204 #define RAW_ID_METHOD_DUMP(Stream, Method, Session, FieldId, ShowFlags, \
205 RecurseFlags) \
206 DumpDIAIdValue(Stream, Indent, StringRef{#Method}, Symbol, \
207 &IDiaSymbol::get_##Method, Session, FieldId, ShowFlags, \
208 RecurseFlags);
209
210 #define RAW_METHOD_DUMP(Stream, Method) \
211 DumpDIAValue(Stream, Indent, StringRef{#Method}, Symbol, \
212 &IDiaSymbol::get_##Method);
213
214 #define RAW_METHOD_DUMP_AS(Stream, Method, Type) \
215 DumpDIAValueAs<Type>(Stream, Indent, StringRef{#Method}, Symbol, \
216 &IDiaSymbol::get_##Method);
217
dump(raw_ostream & OS,int Indent,PdbSymbolIdField ShowIdFields,PdbSymbolIdField RecurseIdFields) const218 void DIARawSymbol::dump(raw_ostream &OS, int Indent,
219 PdbSymbolIdField ShowIdFields,
220 PdbSymbolIdField RecurseIdFields) const {
221 RAW_ID_METHOD_DUMP(OS, symIndexId, Session, PdbSymbolIdField::SymIndexId,
222 ShowIdFields, RecurseIdFields);
223 RAW_METHOD_DUMP_AS(OS, symTag, PDB_SymType);
224
225 RAW_METHOD_DUMP(OS, access);
226 RAW_METHOD_DUMP(OS, addressOffset);
227 RAW_METHOD_DUMP(OS, addressSection);
228 RAW_METHOD_DUMP(OS, age);
229 RAW_METHOD_DUMP(OS, arrayIndexTypeId);
230 RAW_METHOD_DUMP(OS, backEndMajor);
231 RAW_METHOD_DUMP(OS, backEndMinor);
232 RAW_METHOD_DUMP(OS, backEndBuild);
233 RAW_METHOD_DUMP(OS, backEndQFE);
234 RAW_METHOD_DUMP(OS, baseDataOffset);
235 RAW_METHOD_DUMP(OS, baseDataSlot);
236 RAW_METHOD_DUMP(OS, baseSymbolId);
237 RAW_METHOD_DUMP_AS(OS, baseType, PDB_BuiltinType);
238 RAW_METHOD_DUMP(OS, bitPosition);
239 RAW_METHOD_DUMP_AS(OS, callingConvention, PDB_CallingConv);
240 RAW_ID_METHOD_DUMP(OS, classParentId, Session, PdbSymbolIdField::ClassParent,
241 ShowIdFields, RecurseIdFields);
242 RAW_METHOD_DUMP(OS, compilerName);
243 RAW_METHOD_DUMP(OS, count);
244 RAW_METHOD_DUMP(OS, countLiveRanges);
245 RAW_METHOD_DUMP(OS, frontEndMajor);
246 RAW_METHOD_DUMP(OS, frontEndMinor);
247 RAW_METHOD_DUMP(OS, frontEndBuild);
248 RAW_METHOD_DUMP(OS, frontEndQFE);
249 RAW_ID_METHOD_DUMP(OS, lexicalParentId, Session,
250 PdbSymbolIdField::LexicalParent, ShowIdFields,
251 RecurseIdFields);
252 RAW_METHOD_DUMP(OS, libraryName);
253 RAW_METHOD_DUMP(OS, liveRangeStartAddressOffset);
254 RAW_METHOD_DUMP(OS, liveRangeStartAddressSection);
255 RAW_METHOD_DUMP(OS, liveRangeStartRelativeVirtualAddress);
256 RAW_METHOD_DUMP(OS, localBasePointerRegisterId);
257 RAW_METHOD_DUMP(OS, lowerBoundId);
258 RAW_METHOD_DUMP(OS, memorySpaceKind);
259 RAW_METHOD_DUMP(OS, name);
260 RAW_METHOD_DUMP(OS, numberOfAcceleratorPointerTags);
261 RAW_METHOD_DUMP(OS, numberOfColumns);
262 RAW_METHOD_DUMP(OS, numberOfModifiers);
263 RAW_METHOD_DUMP(OS, numberOfRegisterIndices);
264 RAW_METHOD_DUMP(OS, numberOfRows);
265 RAW_METHOD_DUMP(OS, objectFileName);
266 RAW_METHOD_DUMP(OS, oemId);
267 RAW_METHOD_DUMP(OS, oemSymbolId);
268 RAW_METHOD_DUMP(OS, offsetInUdt);
269 RAW_METHOD_DUMP(OS, platform);
270 RAW_METHOD_DUMP(OS, rank);
271 RAW_METHOD_DUMP(OS, registerId);
272 RAW_METHOD_DUMP(OS, registerType);
273 RAW_METHOD_DUMP(OS, relativeVirtualAddress);
274 RAW_METHOD_DUMP(OS, samplerSlot);
275 RAW_METHOD_DUMP(OS, signature);
276 RAW_METHOD_DUMP(OS, sizeInUdt);
277 RAW_METHOD_DUMP(OS, slot);
278 RAW_METHOD_DUMP(OS, sourceFileName);
279 RAW_METHOD_DUMP(OS, stride);
280 RAW_METHOD_DUMP(OS, subTypeId);
281 RAW_METHOD_DUMP(OS, symbolsFileName);
282 RAW_METHOD_DUMP(OS, targetOffset);
283 RAW_METHOD_DUMP(OS, targetRelativeVirtualAddress);
284 RAW_METHOD_DUMP(OS, targetVirtualAddress);
285 RAW_METHOD_DUMP(OS, targetSection);
286 RAW_METHOD_DUMP(OS, textureSlot);
287 RAW_METHOD_DUMP(OS, timeStamp);
288 RAW_METHOD_DUMP(OS, token);
289 RAW_ID_METHOD_DUMP(OS, typeId, Session, PdbSymbolIdField::Type, ShowIdFields,
290 RecurseIdFields);
291 RAW_METHOD_DUMP(OS, uavSlot);
292 RAW_METHOD_DUMP(OS, undecoratedName);
293 RAW_ID_METHOD_DUMP(OS, unmodifiedTypeId, Session,
294 PdbSymbolIdField::UnmodifiedType, ShowIdFields,
295 RecurseIdFields);
296 RAW_METHOD_DUMP(OS, upperBoundId);
297 RAW_METHOD_DUMP(OS, virtualBaseDispIndex);
298 RAW_METHOD_DUMP(OS, virtualBaseOffset);
299 RAW_METHOD_DUMP(OS, virtualTableShapeId);
300 RAW_METHOD_DUMP_AS(OS, dataKind, PDB_DataKind);
301 RAW_METHOD_DUMP(OS, guid);
302 RAW_METHOD_DUMP(OS, offset);
303 RAW_METHOD_DUMP(OS, thisAdjust);
304 RAW_METHOD_DUMP(OS, virtualBasePointerOffset);
305 RAW_METHOD_DUMP_AS(OS, locationType, PDB_LocType);
306 RAW_METHOD_DUMP(OS, machineType);
307 RAW_METHOD_DUMP(OS, thunkOrdinal);
308 RAW_METHOD_DUMP(OS, length);
309 RAW_METHOD_DUMP(OS, liveRangeLength);
310 RAW_METHOD_DUMP(OS, virtualAddress);
311 RAW_METHOD_DUMP_AS(OS, udtKind, PDB_UdtType);
312 RAW_METHOD_DUMP(OS, constructor);
313 RAW_METHOD_DUMP(OS, customCallingConvention);
314 RAW_METHOD_DUMP(OS, farReturn);
315 RAW_METHOD_DUMP(OS, code);
316 RAW_METHOD_DUMP(OS, compilerGenerated);
317 RAW_METHOD_DUMP(OS, constType);
318 RAW_METHOD_DUMP(OS, editAndContinueEnabled);
319 RAW_METHOD_DUMP(OS, function);
320 RAW_METHOD_DUMP(OS, stride);
321 RAW_METHOD_DUMP(OS, noStackOrdering);
322 RAW_METHOD_DUMP(OS, hasAlloca);
323 RAW_METHOD_DUMP(OS, hasAssignmentOperator);
324 RAW_METHOD_DUMP(OS, isCTypes);
325 RAW_METHOD_DUMP(OS, hasCastOperator);
326 RAW_METHOD_DUMP(OS, hasDebugInfo);
327 RAW_METHOD_DUMP(OS, hasEH);
328 RAW_METHOD_DUMP(OS, hasEHa);
329 RAW_METHOD_DUMP(OS, hasInlAsm);
330 RAW_METHOD_DUMP(OS, framePointerPresent);
331 RAW_METHOD_DUMP(OS, inlSpec);
332 RAW_METHOD_DUMP(OS, interruptReturn);
333 RAW_METHOD_DUMP(OS, hasLongJump);
334 RAW_METHOD_DUMP(OS, hasManagedCode);
335 RAW_METHOD_DUMP(OS, hasNestedTypes);
336 RAW_METHOD_DUMP(OS, noInline);
337 RAW_METHOD_DUMP(OS, noReturn);
338 RAW_METHOD_DUMP(OS, optimizedCodeDebugInfo);
339 RAW_METHOD_DUMP(OS, overloadedOperator);
340 RAW_METHOD_DUMP(OS, hasSEH);
341 RAW_METHOD_DUMP(OS, hasSecurityChecks);
342 RAW_METHOD_DUMP(OS, hasSetJump);
343 RAW_METHOD_DUMP(OS, strictGSCheck);
344 RAW_METHOD_DUMP(OS, isAcceleratorGroupSharedLocal);
345 RAW_METHOD_DUMP(OS, isAcceleratorPointerTagLiveRange);
346 RAW_METHOD_DUMP(OS, isAcceleratorStubFunction);
347 RAW_METHOD_DUMP(OS, isAggregated);
348 RAW_METHOD_DUMP(OS, intro);
349 RAW_METHOD_DUMP(OS, isCVTCIL);
350 RAW_METHOD_DUMP(OS, isConstructorVirtualBase);
351 RAW_METHOD_DUMP(OS, isCxxReturnUdt);
352 RAW_METHOD_DUMP(OS, isDataAligned);
353 RAW_METHOD_DUMP(OS, isHLSLData);
354 RAW_METHOD_DUMP(OS, isHotpatchable);
355 RAW_METHOD_DUMP(OS, indirectVirtualBaseClass);
356 RAW_METHOD_DUMP(OS, isInterfaceUdt);
357 RAW_METHOD_DUMP(OS, intrinsic);
358 RAW_METHOD_DUMP(OS, isLTCG);
359 RAW_METHOD_DUMP(OS, isLocationControlFlowDependent);
360 RAW_METHOD_DUMP(OS, isMSILNetmodule);
361 RAW_METHOD_DUMP(OS, isMatrixRowMajor);
362 RAW_METHOD_DUMP(OS, managed);
363 RAW_METHOD_DUMP(OS, msil);
364 RAW_METHOD_DUMP(OS, isMultipleInheritance);
365 RAW_METHOD_DUMP(OS, isNaked);
366 RAW_METHOD_DUMP(OS, nested);
367 RAW_METHOD_DUMP(OS, isOptimizedAway);
368 RAW_METHOD_DUMP(OS, packed);
369 RAW_METHOD_DUMP(OS, isPointerBasedOnSymbolValue);
370 RAW_METHOD_DUMP(OS, isPointerToDataMember);
371 RAW_METHOD_DUMP(OS, isPointerToMemberFunction);
372 RAW_METHOD_DUMP(OS, pure);
373 RAW_METHOD_DUMP(OS, RValueReference);
374 RAW_METHOD_DUMP(OS, isRefUdt);
375 RAW_METHOD_DUMP(OS, reference);
376 RAW_METHOD_DUMP(OS, restrictedType);
377 RAW_METHOD_DUMP(OS, isReturnValue);
378 RAW_METHOD_DUMP(OS, isSafeBuffers);
379 RAW_METHOD_DUMP(OS, scoped);
380 RAW_METHOD_DUMP(OS, isSdl);
381 RAW_METHOD_DUMP(OS, isSingleInheritance);
382 RAW_METHOD_DUMP(OS, isSplitted);
383 RAW_METHOD_DUMP(OS, isStatic);
384 RAW_METHOD_DUMP(OS, isStripped);
385 RAW_METHOD_DUMP(OS, unalignedType);
386 RAW_METHOD_DUMP(OS, notReached);
387 RAW_METHOD_DUMP(OS, isValueUdt);
388 RAW_METHOD_DUMP(OS, virtual);
389 RAW_METHOD_DUMP(OS, virtualBaseClass);
390 RAW_METHOD_DUMP(OS, isVirtualInheritance);
391 RAW_METHOD_DUMP(OS, volatileType);
392 RAW_METHOD_DUMP(OS, wasInlined);
393 RAW_METHOD_DUMP(OS, unused);
394 RAW_METHOD_DUMP(OS, value);
395 }
396
397 std::unique_ptr<IPDBEnumSymbols>
findChildren(PDB_SymType Type) const398 DIARawSymbol::findChildren(PDB_SymType Type) const {
399 enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
400
401 CComPtr<IDiaEnumSymbols> DiaEnumerator;
402 if (S_OK !=
403 Symbol->findChildrenEx(EnumVal, nullptr, nsNone, &DiaEnumerator)) {
404 if (S_OK != Symbol->findChildren(EnumVal, nullptr, nsNone, &DiaEnumerator))
405 return nullptr;
406 }
407
408 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
409 }
410
411 std::unique_ptr<IPDBEnumSymbols>
findChildren(PDB_SymType Type,StringRef Name,PDB_NameSearchFlags Flags) const412 DIARawSymbol::findChildren(PDB_SymType Type, StringRef Name,
413 PDB_NameSearchFlags Flags) const {
414 llvm::SmallVector<UTF16, 32> Name16;
415 llvm::convertUTF8ToUTF16String(Name, Name16);
416
417 enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
418 DWORD CompareFlags = static_cast<DWORD>(Flags);
419 wchar_t *Name16Str = reinterpret_cast<wchar_t *>(Name16.data());
420
421 CComPtr<IDiaEnumSymbols> DiaEnumerator;
422 if (S_OK !=
423 Symbol->findChildrenEx(EnumVal, Name16Str, CompareFlags, &DiaEnumerator))
424 return nullptr;
425
426 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
427 }
428
429 std::unique_ptr<IPDBEnumSymbols>
findChildrenByAddr(PDB_SymType Type,StringRef Name,PDB_NameSearchFlags Flags,uint32_t Section,uint32_t Offset) const430 DIARawSymbol::findChildrenByAddr(PDB_SymType Type, StringRef Name,
431 PDB_NameSearchFlags Flags, uint32_t Section,
432 uint32_t Offset) const {
433 llvm::SmallVector<UTF16, 32> Name16;
434 llvm::convertUTF8ToUTF16String(Name, Name16);
435
436 enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
437
438 DWORD CompareFlags = static_cast<DWORD>(Flags);
439 wchar_t *Name16Str = reinterpret_cast<wchar_t *>(Name16.data());
440
441 CComPtr<IDiaEnumSymbols> DiaEnumerator;
442 if (S_OK != Symbol->findChildrenExByAddr(EnumVal, Name16Str, CompareFlags,
443 Section, Offset, &DiaEnumerator))
444 return nullptr;
445
446 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
447 }
448
449 std::unique_ptr<IPDBEnumSymbols>
findChildrenByVA(PDB_SymType Type,StringRef Name,PDB_NameSearchFlags Flags,uint64_t VA) const450 DIARawSymbol::findChildrenByVA(PDB_SymType Type, StringRef Name,
451 PDB_NameSearchFlags Flags, uint64_t VA) const {
452 llvm::SmallVector<UTF16, 32> Name16;
453 llvm::convertUTF8ToUTF16String(Name, Name16);
454
455 enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
456
457 DWORD CompareFlags = static_cast<DWORD>(Flags);
458 wchar_t *Name16Str = reinterpret_cast<wchar_t *>(Name16.data());
459
460 CComPtr<IDiaEnumSymbols> DiaEnumerator;
461 if (S_OK != Symbol->findChildrenExByVA(EnumVal, Name16Str, CompareFlags, VA,
462 &DiaEnumerator))
463 return nullptr;
464
465 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
466 }
467
468 std::unique_ptr<IPDBEnumSymbols>
findChildrenByRVA(PDB_SymType Type,StringRef Name,PDB_NameSearchFlags Flags,uint32_t RVA) const469 DIARawSymbol::findChildrenByRVA(PDB_SymType Type, StringRef Name,
470 PDB_NameSearchFlags Flags, uint32_t RVA) const {
471 llvm::SmallVector<UTF16, 32> Name16;
472 llvm::convertUTF8ToUTF16String(Name, Name16);
473
474 enum SymTagEnum EnumVal = static_cast<enum SymTagEnum>(Type);
475 DWORD CompareFlags = static_cast<DWORD>(Flags);
476 wchar_t *Name16Str = reinterpret_cast<wchar_t *>(Name16.data());
477
478 CComPtr<IDiaEnumSymbols> DiaEnumerator;
479 if (S_OK != Symbol->findChildrenExByRVA(EnumVal, Name16Str, CompareFlags, RVA,
480 &DiaEnumerator))
481 return nullptr;
482
483 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
484 }
485
486 std::unique_ptr<IPDBEnumSymbols>
findInlineFramesByAddr(uint32_t Section,uint32_t Offset) const487 DIARawSymbol::findInlineFramesByAddr(uint32_t Section, uint32_t Offset) const {
488 CComPtr<IDiaEnumSymbols> DiaEnumerator;
489 if (S_OK != Symbol->findInlineFramesByAddr(Section, Offset, &DiaEnumerator))
490 return nullptr;
491
492 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
493 }
494
495 std::unique_ptr<IPDBEnumSymbols>
findInlineFramesByRVA(uint32_t RVA) const496 DIARawSymbol::findInlineFramesByRVA(uint32_t RVA) const {
497 CComPtr<IDiaEnumSymbols> DiaEnumerator;
498 if (S_OK != Symbol->findInlineFramesByRVA(RVA, &DiaEnumerator))
499 return nullptr;
500
501 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
502 }
503
504 std::unique_ptr<IPDBEnumSymbols>
findInlineFramesByVA(uint64_t VA) const505 DIARawSymbol::findInlineFramesByVA(uint64_t VA) const {
506 CComPtr<IDiaEnumSymbols> DiaEnumerator;
507 if (S_OK != Symbol->findInlineFramesByVA(VA, &DiaEnumerator))
508 return nullptr;
509
510 return std::make_unique<DIAEnumSymbols>(Session, DiaEnumerator);
511 }
512
findInlineeLines() const513 std::unique_ptr<IPDBEnumLineNumbers> DIARawSymbol::findInlineeLines() const {
514 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
515 if (S_OK != Symbol->findInlineeLines(&DiaEnumerator))
516 return nullptr;
517
518 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
519 }
520
521 std::unique_ptr<IPDBEnumLineNumbers>
findInlineeLinesByAddr(uint32_t Section,uint32_t Offset,uint32_t Length) const522 DIARawSymbol::findInlineeLinesByAddr(uint32_t Section, uint32_t Offset,
523 uint32_t Length) const {
524 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
525 if (S_OK !=
526 Symbol->findInlineeLinesByAddr(Section, Offset, Length, &DiaEnumerator))
527 return nullptr;
528
529 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
530 }
531
532 std::unique_ptr<IPDBEnumLineNumbers>
findInlineeLinesByRVA(uint32_t RVA,uint32_t Length) const533 DIARawSymbol::findInlineeLinesByRVA(uint32_t RVA, uint32_t Length) const {
534 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
535 if (S_OK != Symbol->findInlineeLinesByRVA(RVA, Length, &DiaEnumerator))
536 return nullptr;
537
538 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
539 }
540
541 std::unique_ptr<IPDBEnumLineNumbers>
findInlineeLinesByVA(uint64_t VA,uint32_t Length) const542 DIARawSymbol::findInlineeLinesByVA(uint64_t VA, uint32_t Length) const {
543 CComPtr<IDiaEnumLineNumbers> DiaEnumerator;
544 if (S_OK != Symbol->findInlineeLinesByVA(VA, Length, &DiaEnumerator))
545 return nullptr;
546
547 return std::make_unique<DIAEnumLineNumbers>(DiaEnumerator);
548 }
549
getDataBytes(llvm::SmallVector<uint8_t,32> & bytes) const550 void DIARawSymbol::getDataBytes(llvm::SmallVector<uint8_t, 32> &bytes) const {
551 bytes.clear();
552
553 DWORD DataSize = 0;
554 Symbol->get_dataBytes(0, &DataSize, nullptr);
555 if (DataSize == 0)
556 return;
557
558 bytes.resize(DataSize);
559 Symbol->get_dataBytes(DataSize, &DataSize, bytes.data());
560 }
561
getUndecoratedNameEx(PDB_UndnameFlags Flags) const562 std::string DIARawSymbol::getUndecoratedNameEx(PDB_UndnameFlags Flags) const {
563 CComBSTR Result16;
564 if (S_OK != Symbol->get_undecoratedNameEx((DWORD)Flags, &Result16))
565 return std::string();
566
567 const char *SrcBytes = reinterpret_cast<const char *>(Result16.m_str);
568 llvm::ArrayRef<char> SrcByteArray(SrcBytes, Result16.ByteLength());
569 std::string Result8;
570 if (!llvm::convertUTF16ToUTF8String(SrcByteArray, Result8))
571 return std::string();
572 return Result8;
573 }
574
getAccess() const575 PDB_MemberAccess DIARawSymbol::getAccess() const {
576 return PrivateGetDIAValue<DWORD, PDB_MemberAccess>(Symbol,
577 &IDiaSymbol::get_access);
578 }
579
getAddressOffset() const580 uint32_t DIARawSymbol::getAddressOffset() const {
581 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_addressOffset);
582 }
583
getAddressSection() const584 uint32_t DIARawSymbol::getAddressSection() const {
585 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_addressSection);
586 }
587
getAge() const588 uint32_t DIARawSymbol::getAge() const {
589 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_age);
590 }
591
getArrayIndexTypeId() const592 SymIndexId DIARawSymbol::getArrayIndexTypeId() const {
593 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_arrayIndexTypeId);
594 }
595
getBackEndVersion(VersionInfo & Version) const596 void DIARawSymbol::getBackEndVersion(VersionInfo &Version) const {
597 Version.Major = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndMajor);
598 Version.Minor = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndMinor);
599 Version.Build = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndBuild);
600 Version.QFE = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_backEndQFE);
601 }
602
getBaseDataOffset() const603 uint32_t DIARawSymbol::getBaseDataOffset() const {
604 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_baseDataOffset);
605 }
606
getBaseDataSlot() const607 uint32_t DIARawSymbol::getBaseDataSlot() const {
608 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_baseDataSlot);
609 }
610
getBaseSymbolId() const611 SymIndexId DIARawSymbol::getBaseSymbolId() const {
612 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_baseSymbolId);
613 }
614
getBuiltinType() const615 PDB_BuiltinType DIARawSymbol::getBuiltinType() const {
616 return PrivateGetDIAValue<DWORD, PDB_BuiltinType>(Symbol,
617 &IDiaSymbol::get_baseType);
618 }
619
getBitPosition() const620 uint32_t DIARawSymbol::getBitPosition() const {
621 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_bitPosition);
622 }
623
getCallingConvention() const624 PDB_CallingConv DIARawSymbol::getCallingConvention() const {
625 return PrivateGetDIAValue<DWORD, PDB_CallingConv>(
626 Symbol, &IDiaSymbol::get_callingConvention);
627 }
628
getClassParentId() const629 SymIndexId DIARawSymbol::getClassParentId() const {
630 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_classParentId);
631 }
632
getCompilerName() const633 std::string DIARawSymbol::getCompilerName() const {
634 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_compilerName);
635 }
636
getCount() const637 uint32_t DIARawSymbol::getCount() const {
638 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_count);
639 }
640
getCountLiveRanges() const641 uint32_t DIARawSymbol::getCountLiveRanges() const {
642 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_countLiveRanges);
643 }
644
getFrontEndVersion(VersionInfo & Version) const645 void DIARawSymbol::getFrontEndVersion(VersionInfo &Version) const {
646 Version.Major = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndMajor);
647 Version.Minor = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndMinor);
648 Version.Build = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndBuild);
649 Version.QFE = PrivateGetDIAValue(Symbol, &IDiaSymbol::get_frontEndQFE);
650 }
651
getLanguage() const652 PDB_Lang DIARawSymbol::getLanguage() const {
653 return PrivateGetDIAValue<DWORD, PDB_Lang>(Symbol, &IDiaSymbol::get_language);
654 }
655
getLexicalParentId() const656 SymIndexId DIARawSymbol::getLexicalParentId() const {
657 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_lexicalParentId);
658 }
659
getLibraryName() const660 std::string DIARawSymbol::getLibraryName() const {
661 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_libraryName);
662 }
663
getLiveRangeStartAddressOffset() const664 uint32_t DIARawSymbol::getLiveRangeStartAddressOffset() const {
665 return PrivateGetDIAValue(Symbol,
666 &IDiaSymbol::get_liveRangeStartAddressOffset);
667 }
668
getLiveRangeStartAddressSection() const669 uint32_t DIARawSymbol::getLiveRangeStartAddressSection() const {
670 return PrivateGetDIAValue(Symbol,
671 &IDiaSymbol::get_liveRangeStartAddressSection);
672 }
673
getLiveRangeStartRelativeVirtualAddress() const674 uint32_t DIARawSymbol::getLiveRangeStartRelativeVirtualAddress() const {
675 return PrivateGetDIAValue(
676 Symbol, &IDiaSymbol::get_liveRangeStartRelativeVirtualAddress);
677 }
678
getLocalBasePointerRegisterId() const679 codeview::RegisterId DIARawSymbol::getLocalBasePointerRegisterId() const {
680 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
681 Symbol, &IDiaSymbol::get_localBasePointerRegisterId);
682 }
683
getLowerBoundId() const684 SymIndexId DIARawSymbol::getLowerBoundId() const {
685 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_lowerBoundId);
686 }
687
getMemorySpaceKind() const688 uint32_t DIARawSymbol::getMemorySpaceKind() const {
689 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_memorySpaceKind);
690 }
691
getName() const692 std::string DIARawSymbol::getName() const {
693 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_name);
694 }
695
getNumberOfAcceleratorPointerTags() const696 uint32_t DIARawSymbol::getNumberOfAcceleratorPointerTags() const {
697 return PrivateGetDIAValue(Symbol,
698 &IDiaSymbol::get_numberOfAcceleratorPointerTags);
699 }
700
getNumberOfColumns() const701 uint32_t DIARawSymbol::getNumberOfColumns() const {
702 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfColumns);
703 }
704
getNumberOfModifiers() const705 uint32_t DIARawSymbol::getNumberOfModifiers() const {
706 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfModifiers);
707 }
708
getNumberOfRegisterIndices() const709 uint32_t DIARawSymbol::getNumberOfRegisterIndices() const {
710 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfRegisterIndices);
711 }
712
getNumberOfRows() const713 uint32_t DIARawSymbol::getNumberOfRows() const {
714 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_numberOfRows);
715 }
716
getObjectFileName() const717 std::string DIARawSymbol::getObjectFileName() const {
718 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_objectFileName);
719 }
720
getOemId() const721 uint32_t DIARawSymbol::getOemId() const {
722 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_oemId);
723 }
724
getOemSymbolId() const725 SymIndexId DIARawSymbol::getOemSymbolId() const {
726 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_oemSymbolId);
727 }
728
getOffsetInUdt() const729 uint32_t DIARawSymbol::getOffsetInUdt() const {
730 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_offsetInUdt);
731 }
732
getPlatform() const733 PDB_Cpu DIARawSymbol::getPlatform() const {
734 return PrivateGetDIAValue<DWORD, PDB_Cpu>(Symbol, &IDiaSymbol::get_platform);
735 }
736
getRank() const737 uint32_t DIARawSymbol::getRank() const {
738 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_rank);
739 }
740
getRegisterId() const741 codeview::RegisterId DIARawSymbol::getRegisterId() const {
742 return PrivateGetDIAValue<DWORD, codeview::RegisterId>(
743 Symbol, &IDiaSymbol::get_registerId);
744 }
745
getRegisterType() const746 uint32_t DIARawSymbol::getRegisterType() const {
747 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_registerType);
748 }
749
getRelativeVirtualAddress() const750 uint32_t DIARawSymbol::getRelativeVirtualAddress() const {
751 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_relativeVirtualAddress);
752 }
753
getSamplerSlot() const754 uint32_t DIARawSymbol::getSamplerSlot() const {
755 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_samplerSlot);
756 }
757
getSignature() const758 uint32_t DIARawSymbol::getSignature() const {
759 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_signature);
760 }
761
getSizeInUdt() const762 uint32_t DIARawSymbol::getSizeInUdt() const {
763 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_sizeInUdt);
764 }
765
getSlot() const766 uint32_t DIARawSymbol::getSlot() const {
767 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_slot);
768 }
769
getSourceFileName() const770 std::string DIARawSymbol::getSourceFileName() const {
771 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_sourceFileName);
772 }
773
getSrcLineOnTypeDefn() const774 std::unique_ptr<IPDBLineNumber> DIARawSymbol::getSrcLineOnTypeDefn() const {
775 CComPtr<IDiaLineNumber> LineNumber;
776 if (FAILED(Symbol->getSrcLineOnTypeDefn(&LineNumber)) || !LineNumber)
777 return nullptr;
778
779 return std::make_unique<DIALineNumber>(LineNumber);
780 }
781
getStride() const782 uint32_t DIARawSymbol::getStride() const {
783 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_stride);
784 }
785
getSubTypeId() const786 SymIndexId DIARawSymbol::getSubTypeId() const {
787 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_subTypeId);
788 }
789
getSymbolsFileName() const790 std::string DIARawSymbol::getSymbolsFileName() const {
791 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_symbolsFileName);
792 }
793
getSymIndexId() const794 SymIndexId DIARawSymbol::getSymIndexId() const {
795 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_symIndexId);
796 }
797
getTargetOffset() const798 uint32_t DIARawSymbol::getTargetOffset() const {
799 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_targetOffset);
800 }
801
getTargetRelativeVirtualAddress() const802 uint32_t DIARawSymbol::getTargetRelativeVirtualAddress() const {
803 return PrivateGetDIAValue(Symbol,
804 &IDiaSymbol::get_targetRelativeVirtualAddress);
805 }
806
getTargetVirtualAddress() const807 uint64_t DIARawSymbol::getTargetVirtualAddress() const {
808 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_targetVirtualAddress);
809 }
810
getTargetSection() const811 uint32_t DIARawSymbol::getTargetSection() const {
812 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_targetSection);
813 }
814
getTextureSlot() const815 uint32_t DIARawSymbol::getTextureSlot() const {
816 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_textureSlot);
817 }
818
getTimeStamp() const819 uint32_t DIARawSymbol::getTimeStamp() const {
820 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_timeStamp);
821 }
822
getToken() const823 uint32_t DIARawSymbol::getToken() const {
824 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_token);
825 }
826
getTypeId() const827 SymIndexId DIARawSymbol::getTypeId() const {
828 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_typeId);
829 }
830
getUavSlot() const831 uint32_t DIARawSymbol::getUavSlot() const {
832 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_uavSlot);
833 }
834
getUndecoratedName() const835 std::string DIARawSymbol::getUndecoratedName() const {
836 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_undecoratedName);
837 }
838
getUnmodifiedTypeId() const839 SymIndexId DIARawSymbol::getUnmodifiedTypeId() const {
840 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_unmodifiedTypeId);
841 }
842
getUpperBoundId() const843 SymIndexId DIARawSymbol::getUpperBoundId() const {
844 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_upperBoundId);
845 }
846
getValue() const847 Variant DIARawSymbol::getValue() const {
848 VARIANT Value;
849 Value.vt = VT_EMPTY;
850 if (S_OK != Symbol->get_value(&Value))
851 return Variant();
852
853 return VariantFromVARIANT(Value);
854 }
855
getVirtualBaseDispIndex() const856 uint32_t DIARawSymbol::getVirtualBaseDispIndex() const {
857 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBaseDispIndex);
858 }
859
getVirtualBaseOffset() const860 uint32_t DIARawSymbol::getVirtualBaseOffset() const {
861 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBaseOffset);
862 }
863
getVirtualTableShapeId() const864 SymIndexId DIARawSymbol::getVirtualTableShapeId() const {
865 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualTableShapeId);
866 }
867
868 std::unique_ptr<PDBSymbolTypeBuiltin>
getVirtualBaseTableType() const869 DIARawSymbol::getVirtualBaseTableType() const {
870 CComPtr<IDiaSymbol> TableType;
871 if (FAILED(Symbol->get_virtualBaseTableType(&TableType)) || !TableType)
872 return nullptr;
873
874 auto RawVT = std::make_unique<DIARawSymbol>(Session, TableType);
875 auto Pointer =
876 PDBSymbol::createAs<PDBSymbolTypePointer>(Session, std::move(RawVT));
877 return unique_dyn_cast<PDBSymbolTypeBuiltin>(Pointer->getPointeeType());
878 }
879
getDataKind() const880 PDB_DataKind DIARawSymbol::getDataKind() const {
881 return PrivateGetDIAValue<DWORD, PDB_DataKind>(Symbol,
882 &IDiaSymbol::get_dataKind);
883 }
884
getSymTag() const885 PDB_SymType DIARawSymbol::getSymTag() const {
886 return PrivateGetDIAValue<DWORD, PDB_SymType>(Symbol,
887 &IDiaSymbol::get_symTag);
888 }
889
getGuid() const890 codeview::GUID DIARawSymbol::getGuid() const {
891 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_guid);
892 }
893
getOffset() const894 int32_t DIARawSymbol::getOffset() const {
895 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_offset);
896 }
897
getThisAdjust() const898 int32_t DIARawSymbol::getThisAdjust() const {
899 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_thisAdjust);
900 }
901
getVirtualBasePointerOffset() const902 int32_t DIARawSymbol::getVirtualBasePointerOffset() const {
903 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBasePointerOffset);
904 }
905
getLocationType() const906 PDB_LocType DIARawSymbol::getLocationType() const {
907 return PrivateGetDIAValue<DWORD, PDB_LocType>(Symbol,
908 &IDiaSymbol::get_locationType);
909 }
910
getMachineType() const911 PDB_Machine DIARawSymbol::getMachineType() const {
912 return PrivateGetDIAValue<DWORD, PDB_Machine>(Symbol,
913 &IDiaSymbol::get_machineType);
914 }
915
getThunkOrdinal() const916 codeview::ThunkOrdinal DIARawSymbol::getThunkOrdinal() const {
917 return PrivateGetDIAValue<DWORD, codeview::ThunkOrdinal>(
918 Symbol, &IDiaSymbol::get_thunkOrdinal);
919 }
920
getLength() const921 uint64_t DIARawSymbol::getLength() const {
922 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_length);
923 }
924
getLiveRangeLength() const925 uint64_t DIARawSymbol::getLiveRangeLength() const {
926 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_liveRangeLength);
927 }
928
getVirtualAddress() const929 uint64_t DIARawSymbol::getVirtualAddress() const {
930 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualAddress);
931 }
932
getUdtKind() const933 PDB_UdtType DIARawSymbol::getUdtKind() const {
934 return PrivateGetDIAValue<DWORD, PDB_UdtType>(Symbol,
935 &IDiaSymbol::get_udtKind);
936 }
937
hasConstructor() const938 bool DIARawSymbol::hasConstructor() const {
939 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_constructor);
940 }
941
hasCustomCallingConvention() const942 bool DIARawSymbol::hasCustomCallingConvention() const {
943 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_customCallingConvention);
944 }
945
hasFarReturn() const946 bool DIARawSymbol::hasFarReturn() const {
947 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_farReturn);
948 }
949
isCode() const950 bool DIARawSymbol::isCode() const {
951 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_code);
952 }
953
isCompilerGenerated() const954 bool DIARawSymbol::isCompilerGenerated() const {
955 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_compilerGenerated);
956 }
957
isConstType() const958 bool DIARawSymbol::isConstType() const {
959 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_constType);
960 }
961
isEditAndContinueEnabled() const962 bool DIARawSymbol::isEditAndContinueEnabled() const {
963 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_editAndContinueEnabled);
964 }
965
isFunction() const966 bool DIARawSymbol::isFunction() const {
967 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_function);
968 }
969
getAddressTaken() const970 bool DIARawSymbol::getAddressTaken() const {
971 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_addressTaken);
972 }
973
getNoStackOrdering() const974 bool DIARawSymbol::getNoStackOrdering() const {
975 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_noStackOrdering);
976 }
977
hasAlloca() const978 bool DIARawSymbol::hasAlloca() const {
979 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasAlloca);
980 }
981
hasAssignmentOperator() const982 bool DIARawSymbol::hasAssignmentOperator() const {
983 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasAssignmentOperator);
984 }
985
hasCTypes() const986 bool DIARawSymbol::hasCTypes() const {
987 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isCTypes);
988 }
989
hasCastOperator() const990 bool DIARawSymbol::hasCastOperator() const {
991 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasCastOperator);
992 }
993
hasDebugInfo() const994 bool DIARawSymbol::hasDebugInfo() const {
995 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasDebugInfo);
996 }
997
hasEH() const998 bool DIARawSymbol::hasEH() const {
999 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasEH);
1000 }
1001
hasEHa() const1002 bool DIARawSymbol::hasEHa() const {
1003 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasEHa);
1004 }
1005
hasInlAsm() const1006 bool DIARawSymbol::hasInlAsm() const {
1007 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasInlAsm);
1008 }
1009
hasInlineAttribute() const1010 bool DIARawSymbol::hasInlineAttribute() const {
1011 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_inlSpec);
1012 }
1013
hasInterruptReturn() const1014 bool DIARawSymbol::hasInterruptReturn() const {
1015 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_interruptReturn);
1016 }
1017
hasFramePointer() const1018 bool DIARawSymbol::hasFramePointer() const {
1019 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_framePointerPresent);
1020 }
1021
hasLongJump() const1022 bool DIARawSymbol::hasLongJump() const {
1023 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasLongJump);
1024 }
1025
hasManagedCode() const1026 bool DIARawSymbol::hasManagedCode() const {
1027 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasManagedCode);
1028 }
1029
hasNestedTypes() const1030 bool DIARawSymbol::hasNestedTypes() const {
1031 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasNestedTypes);
1032 }
1033
hasNoInlineAttribute() const1034 bool DIARawSymbol::hasNoInlineAttribute() const {
1035 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_noInline);
1036 }
1037
hasNoReturnAttribute() const1038 bool DIARawSymbol::hasNoReturnAttribute() const {
1039 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_noReturn);
1040 }
1041
hasOptimizedCodeDebugInfo() const1042 bool DIARawSymbol::hasOptimizedCodeDebugInfo() const {
1043 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_optimizedCodeDebugInfo);
1044 }
1045
hasOverloadedOperator() const1046 bool DIARawSymbol::hasOverloadedOperator() const {
1047 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_overloadedOperator);
1048 }
1049
hasSEH() const1050 bool DIARawSymbol::hasSEH() const {
1051 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasSEH);
1052 }
1053
hasSecurityChecks() const1054 bool DIARawSymbol::hasSecurityChecks() const {
1055 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasSecurityChecks);
1056 }
1057
hasSetJump() const1058 bool DIARawSymbol::hasSetJump() const {
1059 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_hasSetJump);
1060 }
1061
hasStrictGSCheck() const1062 bool DIARawSymbol::hasStrictGSCheck() const {
1063 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_strictGSCheck);
1064 }
1065
isAcceleratorGroupSharedLocal() const1066 bool DIARawSymbol::isAcceleratorGroupSharedLocal() const {
1067 return PrivateGetDIAValue(Symbol,
1068 &IDiaSymbol::get_isAcceleratorGroupSharedLocal);
1069 }
1070
isAcceleratorPointerTagLiveRange() const1071 bool DIARawSymbol::isAcceleratorPointerTagLiveRange() const {
1072 return PrivateGetDIAValue(Symbol,
1073 &IDiaSymbol::get_isAcceleratorPointerTagLiveRange);
1074 }
1075
isAcceleratorStubFunction() const1076 bool DIARawSymbol::isAcceleratorStubFunction() const {
1077 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isAcceleratorStubFunction);
1078 }
1079
isAggregated() const1080 bool DIARawSymbol::isAggregated() const {
1081 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isAggregated);
1082 }
1083
isIntroVirtualFunction() const1084 bool DIARawSymbol::isIntroVirtualFunction() const {
1085 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_intro);
1086 }
1087
isCVTCIL() const1088 bool DIARawSymbol::isCVTCIL() const {
1089 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isCVTCIL);
1090 }
1091
isConstructorVirtualBase() const1092 bool DIARawSymbol::isConstructorVirtualBase() const {
1093 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isConstructorVirtualBase);
1094 }
1095
isCxxReturnUdt() const1096 bool DIARawSymbol::isCxxReturnUdt() const {
1097 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isCxxReturnUdt);
1098 }
1099
isDataAligned() const1100 bool DIARawSymbol::isDataAligned() const {
1101 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isDataAligned);
1102 }
1103
isHLSLData() const1104 bool DIARawSymbol::isHLSLData() const {
1105 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isHLSLData);
1106 }
1107
isHotpatchable() const1108 bool DIARawSymbol::isHotpatchable() const {
1109 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isHotpatchable);
1110 }
1111
isIndirectVirtualBaseClass() const1112 bool DIARawSymbol::isIndirectVirtualBaseClass() const {
1113 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_indirectVirtualBaseClass);
1114 }
1115
isInterfaceUdt() const1116 bool DIARawSymbol::isInterfaceUdt() const {
1117 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isInterfaceUdt);
1118 }
1119
isIntrinsic() const1120 bool DIARawSymbol::isIntrinsic() const {
1121 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_intrinsic);
1122 }
1123
isLTCG() const1124 bool DIARawSymbol::isLTCG() const {
1125 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isLTCG);
1126 }
1127
isLocationControlFlowDependent() const1128 bool DIARawSymbol::isLocationControlFlowDependent() const {
1129 return PrivateGetDIAValue(Symbol,
1130 &IDiaSymbol::get_isLocationControlFlowDependent);
1131 }
1132
isMSILNetmodule() const1133 bool DIARawSymbol::isMSILNetmodule() const {
1134 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isMSILNetmodule);
1135 }
1136
isMatrixRowMajor() const1137 bool DIARawSymbol::isMatrixRowMajor() const {
1138 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isMatrixRowMajor);
1139 }
1140
isManagedCode() const1141 bool DIARawSymbol::isManagedCode() const {
1142 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_managed);
1143 }
1144
isMSILCode() const1145 bool DIARawSymbol::isMSILCode() const {
1146 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_msil);
1147 }
1148
isMultipleInheritance() const1149 bool DIARawSymbol::isMultipleInheritance() const {
1150 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isMultipleInheritance);
1151 }
1152
isNaked() const1153 bool DIARawSymbol::isNaked() const {
1154 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isNaked);
1155 }
1156
isNested() const1157 bool DIARawSymbol::isNested() const {
1158 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_nested);
1159 }
1160
isOptimizedAway() const1161 bool DIARawSymbol::isOptimizedAway() const {
1162 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isOptimizedAway);
1163 }
1164
isPacked() const1165 bool DIARawSymbol::isPacked() const {
1166 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_packed);
1167 }
1168
isPointerBasedOnSymbolValue() const1169 bool DIARawSymbol::isPointerBasedOnSymbolValue() const {
1170 return PrivateGetDIAValue(Symbol,
1171 &IDiaSymbol::get_isPointerBasedOnSymbolValue);
1172 }
1173
isPointerToDataMember() const1174 bool DIARawSymbol::isPointerToDataMember() const {
1175 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isPointerToDataMember);
1176 }
1177
isPointerToMemberFunction() const1178 bool DIARawSymbol::isPointerToMemberFunction() const {
1179 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isPointerToMemberFunction);
1180 }
1181
isPureVirtual() const1182 bool DIARawSymbol::isPureVirtual() const {
1183 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_pure);
1184 }
1185
isRValueReference() const1186 bool DIARawSymbol::isRValueReference() const {
1187 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_RValueReference);
1188 }
1189
isRefUdt() const1190 bool DIARawSymbol::isRefUdt() const {
1191 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isRefUdt);
1192 }
1193
isReference() const1194 bool DIARawSymbol::isReference() const {
1195 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_reference);
1196 }
1197
isRestrictedType() const1198 bool DIARawSymbol::isRestrictedType() const {
1199 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_restrictedType);
1200 }
1201
isReturnValue() const1202 bool DIARawSymbol::isReturnValue() const {
1203 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isReturnValue);
1204 }
1205
isSafeBuffers() const1206 bool DIARawSymbol::isSafeBuffers() const {
1207 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSafeBuffers);
1208 }
1209
isScoped() const1210 bool DIARawSymbol::isScoped() const {
1211 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_scoped);
1212 }
1213
isSdl() const1214 bool DIARawSymbol::isSdl() const {
1215 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSdl);
1216 }
1217
isSingleInheritance() const1218 bool DIARawSymbol::isSingleInheritance() const {
1219 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSingleInheritance);
1220 }
1221
isSplitted() const1222 bool DIARawSymbol::isSplitted() const {
1223 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isSplitted);
1224 }
1225
isStatic() const1226 bool DIARawSymbol::isStatic() const {
1227 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isStatic);
1228 }
1229
hasPrivateSymbols() const1230 bool DIARawSymbol::hasPrivateSymbols() const {
1231 // hasPrivateSymbols is the opposite of isStripped, but we expose
1232 // hasPrivateSymbols as a more intuitive interface.
1233 return !PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isStripped);
1234 }
1235
isUnalignedType() const1236 bool DIARawSymbol::isUnalignedType() const {
1237 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_unalignedType);
1238 }
1239
isUnreached() const1240 bool DIARawSymbol::isUnreached() const {
1241 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_notReached);
1242 }
1243
isValueUdt() const1244 bool DIARawSymbol::isValueUdt() const {
1245 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isValueUdt);
1246 }
1247
isVirtual() const1248 bool DIARawSymbol::isVirtual() const {
1249 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtual);
1250 }
1251
isVirtualBaseClass() const1252 bool DIARawSymbol::isVirtualBaseClass() const {
1253 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_virtualBaseClass);
1254 }
1255
isVirtualInheritance() const1256 bool DIARawSymbol::isVirtualInheritance() const {
1257 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_isVirtualInheritance);
1258 }
1259
isVolatileType() const1260 bool DIARawSymbol::isVolatileType() const {
1261 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_volatileType);
1262 }
1263
wasInlined() const1264 bool DIARawSymbol::wasInlined() const {
1265 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_wasInlined);
1266 }
1267
getUnused() const1268 std::string DIARawSymbol::getUnused() const {
1269 return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_unused);
1270 }
1271