llvm.org GIT mirror llvm / 25ccaa7
[PDB] Support pointer types in the native reader. In order to start testing this, I've added a new mode to llvm-pdbutil which is only really useful for writing tests. It just dumps the value of raw fields in record format. This isn't really ideal and it won't allow us to test some important cases, but it's better than nothing for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@341729 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 1 year, 13 days ago
18 changed file(s) with 726 addition(s) and 197 deletion(s). Raw diff Collapse all Expand all
2222
2323 class PDBSymbolTypeVTable;
2424 class PDBSymbolTypeVTableShape;
25
26 template
27 void dumpSymbolField(raw_ostream &OS, StringRef Name, T Value, int Indent) {
28 OS << "\n";
29 OS.indent(Indent);
30 OS << Name << ": " << Value;
31 }
2532
2633 /// IPDBRawSymbol defines an interface used to represent an arbitrary symbol.
2734 /// It exposes a monolithic interface consisting of accessors for the union of
2020 NativeCompilandSymbol(NativeSession &Session, SymIndexId SymbolId,
2121 DbiModuleDescriptor MI);
2222
23 void dump(raw_ostream &OS, int Indent) const override;
24
2325 std::unique_ptr clone() const override;
2426
2527 PDB_SymType getSymTag() const override;
2424 const codeview::CVType &CV);
2525 ~NativeTypeEnum() override;
2626
27 void dump(raw_ostream &OS, int Indent) const override;
28
2729 std::unique_ptr clone() const override;
2830
2931 std::unique_ptr
3436 Error visitKnownMember(codeview::CVMemberRecord &CVM,
3537 codeview::EnumeratorRecord &Record) override;
3638
39 PDB_BuiltinType getBuiltinType() const override;
3740 PDB_SymType getSymTag() const override;
38 uint32_t getClassParentId() const override;
3941 uint32_t getUnmodifiedTypeId() const override;
4042 bool hasConstructor() const override;
4143 bool hasAssignmentOperator() const override;
4446 std::string getName() const override;
4547 bool isNested() const override;
4648 bool hasOverloadedOperator() const override;
49 bool hasNestedTypes() const override;
50 bool isIntrinsic() const override;
4751 bool isPacked() const override;
4852 bool isScoped() const override;
4953 uint32_t getTypeId() const override;
54 bool isRefUdt() const override;
55 bool isValueUdt() const override;
56 bool isInterfaceUdt() const override;
5057
5158 protected:
5259 codeview::CVType CV;
0 //===- NativeTypePointer.h - info about pointer type ------------------*- C++
1 //-*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
11 #define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
12
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/DebugInfo/CodeView/TypeRecord.h"
15 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
16 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
17
18 namespace llvm {
19 namespace pdb {
20
21 class NativeTypePointer : public NativeRawSymbol {
22 public:
23 NativeTypePointer(NativeSession &Session, SymIndexId Id, codeview::CVType CV);
24 NativeTypePointer(NativeSession &Session, SymIndexId Id,
25 codeview::PointerRecord PR);
26 ~NativeTypePointer() override;
27
28 void dump(raw_ostream &OS, int Indent) const override;
29 std::unique_ptr clone() const override;
30
31 bool isConstType() const override;
32 uint64_t getLength() const override;
33 bool isReference() const override;
34 bool isRValueReference() const override;
35 bool isPointerToDataMember() const override;
36 bool isPointerToMemberFunction() const override;
37 uint32_t getTypeId() const override;
38 bool isRestrictedType() const override;
39 bool isVolatileType() const override;
40 bool isUnalignedType() const override;
41
42 protected:
43 codeview::PointerRecord Record;
44 };
45
46 } // namespace pdb
47 } // namespace llvm
48
49 #endif // LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
3030 std::vector> Cache;
3131 DenseMap TypeIndexToSymbolId;
3232 std::vector Compilands;
33
34 SymIndexId createSymbolPlaceholder() {
35 SymIndexId Id = Cache.size();
36 Cache.push_back(nullptr);
37 return Id;
38 }
3339
3440 public:
3541 SymbolCache(NativeSession &Session, DbiStream *Dbi);
5252 Native/NativeRawSymbol.cpp
5353 Native/NativeTypeBuiltin.cpp
5454 Native/NativeTypeEnum.cpp
55 Native/NativeTypePointer.cpp
5556 Native/NamedStreamMap.cpp
5657 Native/NativeSession.cpp
5758 Native/PDBFile.cpp
145145 IDiaSymbol *Symbol,
146146 HRESULT (__stdcall IDiaSymbol::*Method)(ArgType *)) {
147147 ArgType Value;
148 if (S_OK == (Symbol->*Method)(&Value)) {
149 OS << "\n";
150 OS.indent(Indent);
151 OS << Name << ": " << Value;
152 }
148 if (S_OK == (Symbol->*Method)(&Value))
149 dumpSymbolField(OS, Name, Value, Indent);
153150 }
154151
155152 void DumpDIAValue(llvm::raw_ostream &OS, int Indent, StringRef Name,
161158 const char *Bytes = reinterpret_cast(Value);
162159 ArrayRef ByteArray(Bytes, ::SysStringByteLen(Value));
163160 std::string Result;
164 if (llvm::convertUTF16ToUTF8String(ByteArray, Result)) {
165 OS << "\n";
166 OS.indent(Indent);
167 OS << Name << ": " << Result;
168 }
161 if (llvm::convertUTF16ToUTF8String(ByteArray, Result))
162 dumpSymbolField(OS, Name, Result, Indent);
169163 ::SysFreeString(Value);
170164 }
171165
176170 Value.vt = VT_EMPTY;
177171 if (S_OK != (Symbol->*Method)(&Value))
178172 return;
179 OS << "\n";
180 OS.indent(Indent);
181173 Variant V = VariantFromVARIANT(Value);
182 OS << Name << ": " << V;
174
175 dumpSymbolField(OS, Name, V, Indent);
183176 }
184177 }
185178
197190 : Session(PDBSession), Symbol(DiaSymbol) {}
198191
199192 #define RAW_METHOD_DUMP(Stream, Method) \
200 DumpDIAValue(Stream, Indent, StringRef(#Method), Symbol, &IDiaSymbol::Method);
193 DumpDIAValue(Stream, Indent, StringRef(#Method), Symbol, \
194 &IDiaSymbol::get_##Method);
201195
202196 void DIARawSymbol::dump(raw_ostream &OS, int Indent) const {
203 RAW_METHOD_DUMP(OS, get_access)
204 RAW_METHOD_DUMP(OS, get_addressOffset)
205 RAW_METHOD_DUMP(OS, get_addressSection)
206 RAW_METHOD_DUMP(OS, get_age)
207 RAW_METHOD_DUMP(OS, get_arrayIndexTypeId)
208 RAW_METHOD_DUMP(OS, get_backEndMajor)
209 RAW_METHOD_DUMP(OS, get_backEndMinor)
210 RAW_METHOD_DUMP(OS, get_backEndBuild)
211 RAW_METHOD_DUMP(OS, get_backEndQFE)
212 RAW_METHOD_DUMP(OS, get_baseDataOffset)
213 RAW_METHOD_DUMP(OS, get_baseDataSlot)
214 RAW_METHOD_DUMP(OS, get_baseSymbolId)
215 RAW_METHOD_DUMP(OS, get_baseType)
216 RAW_METHOD_DUMP(OS, get_bitPosition)
217 RAW_METHOD_DUMP(OS, get_callingConvention)
218 RAW_METHOD_DUMP(OS, get_classParentId)
219 RAW_METHOD_DUMP(OS, get_compilerName)
220 RAW_METHOD_DUMP(OS, get_count)
221 RAW_METHOD_DUMP(OS, get_countLiveRanges)
222 RAW_METHOD_DUMP(OS, get_frontEndMajor)
223 RAW_METHOD_DUMP(OS, get_frontEndMinor)
224 RAW_METHOD_DUMP(OS, get_frontEndBuild)
225 RAW_METHOD_DUMP(OS, get_frontEndQFE)
226 RAW_METHOD_DUMP(OS, get_lexicalParentId)
227 RAW_METHOD_DUMP(OS, get_libraryName)
228 RAW_METHOD_DUMP(OS, get_liveRangeStartAddressOffset)
229 RAW_METHOD_DUMP(OS, get_liveRangeStartAddressSection)
230 RAW_METHOD_DUMP(OS, get_liveRangeStartRelativeVirtualAddress)
231 RAW_METHOD_DUMP(OS, get_localBasePointerRegisterId)
232 RAW_METHOD_DUMP(OS, get_lowerBoundId)
233 RAW_METHOD_DUMP(OS, get_memorySpaceKind)
234 RAW_METHOD_DUMP(OS, get_name)
235 RAW_METHOD_DUMP(OS, get_numberOfAcceleratorPointerTags)
236 RAW_METHOD_DUMP(OS, get_numberOfColumns)
237 RAW_METHOD_DUMP(OS, get_numberOfModifiers)
238 RAW_METHOD_DUMP(OS, get_numberOfRegisterIndices)
239 RAW_METHOD_DUMP(OS, get_numberOfRows)
240 RAW_METHOD_DUMP(OS, get_objectFileName)
241 RAW_METHOD_DUMP(OS, get_oemId)
242 RAW_METHOD_DUMP(OS, get_oemSymbolId)
243 RAW_METHOD_DUMP(OS, get_offsetInUdt)
244 RAW_METHOD_DUMP(OS, get_platform)
245 RAW_METHOD_DUMP(OS, get_rank)
246 RAW_METHOD_DUMP(OS, get_registerId)
247 RAW_METHOD_DUMP(OS, get_registerType)
248 RAW_METHOD_DUMP(OS, get_relativeVirtualAddress)
249 RAW_METHOD_DUMP(OS, get_samplerSlot)
250 RAW_METHOD_DUMP(OS, get_signature)
251 RAW_METHOD_DUMP(OS, get_sizeInUdt)
252 RAW_METHOD_DUMP(OS, get_slot)
253 RAW_METHOD_DUMP(OS, get_sourceFileName)
254 RAW_METHOD_DUMP(OS, get_stride)
255 RAW_METHOD_DUMP(OS, get_subTypeId)
256 RAW_METHOD_DUMP(OS, get_symbolsFileName)
257 RAW_METHOD_DUMP(OS, get_symIndexId)
258 RAW_METHOD_DUMP(OS, get_targetOffset)
259 RAW_METHOD_DUMP(OS, get_targetRelativeVirtualAddress)
260 RAW_METHOD_DUMP(OS, get_targetVirtualAddress)
261 RAW_METHOD_DUMP(OS, get_targetSection)
262 RAW_METHOD_DUMP(OS, get_textureSlot)
263 RAW_METHOD_DUMP(OS, get_timeStamp)
264 RAW_METHOD_DUMP(OS, get_token)
265 RAW_METHOD_DUMP(OS, get_typeId)
266 RAW_METHOD_DUMP(OS, get_uavSlot)
267 RAW_METHOD_DUMP(OS, get_undecoratedName)
268 RAW_METHOD_DUMP(OS, get_unmodifiedTypeId)
269 RAW_METHOD_DUMP(OS, get_upperBoundId)
270 RAW_METHOD_DUMP(OS, get_virtualBaseDispIndex)
271 RAW_METHOD_DUMP(OS, get_virtualBaseOffset)
272 RAW_METHOD_DUMP(OS, get_virtualTableShapeId)
273 RAW_METHOD_DUMP(OS, get_dataKind)
274 RAW_METHOD_DUMP(OS, get_symTag)
275 RAW_METHOD_DUMP(OS, get_guid)
276 RAW_METHOD_DUMP(OS, get_offset)
277 RAW_METHOD_DUMP(OS, get_thisAdjust)
278 RAW_METHOD_DUMP(OS, get_virtualBasePointerOffset)
279 RAW_METHOD_DUMP(OS, get_locationType)
280 RAW_METHOD_DUMP(OS, get_machineType)
281 RAW_METHOD_DUMP(OS, get_thunkOrdinal)
282 RAW_METHOD_DUMP(OS, get_length)
283 RAW_METHOD_DUMP(OS, get_liveRangeLength)
284 RAW_METHOD_DUMP(OS, get_virtualAddress)
285 RAW_METHOD_DUMP(OS, get_udtKind)
286 RAW_METHOD_DUMP(OS, get_constructor)
287 RAW_METHOD_DUMP(OS, get_customCallingConvention)
288 RAW_METHOD_DUMP(OS, get_farReturn)
289 RAW_METHOD_DUMP(OS, get_code)
290 RAW_METHOD_DUMP(OS, get_compilerGenerated)
291 RAW_METHOD_DUMP(OS, get_constType)
292 RAW_METHOD_DUMP(OS, get_editAndContinueEnabled)
293 RAW_METHOD_DUMP(OS, get_function)
294 RAW_METHOD_DUMP(OS, get_stride)
295 RAW_METHOD_DUMP(OS, get_noStackOrdering)
296 RAW_METHOD_DUMP(OS, get_hasAlloca)
297 RAW_METHOD_DUMP(OS, get_hasAssignmentOperator)
298 RAW_METHOD_DUMP(OS, get_isCTypes)
299 RAW_METHOD_DUMP(OS, get_hasCastOperator)
300 RAW_METHOD_DUMP(OS, get_hasDebugInfo)
301 RAW_METHOD_DUMP(OS, get_hasEH)
302 RAW_METHOD_DUMP(OS, get_hasEHa)
303 RAW_METHOD_DUMP(OS, get_hasInlAsm)
304 RAW_METHOD_DUMP(OS, get_framePointerPresent)
305 RAW_METHOD_DUMP(OS, get_inlSpec)
306 RAW_METHOD_DUMP(OS, get_interruptReturn)
307 RAW_METHOD_DUMP(OS, get_hasLongJump)
308 RAW_METHOD_DUMP(OS, get_hasManagedCode)
309 RAW_METHOD_DUMP(OS, get_hasNestedTypes)
310 RAW_METHOD_DUMP(OS, get_noInline)
311 RAW_METHOD_DUMP(OS, get_noReturn)
312 RAW_METHOD_DUMP(OS, get_optimizedCodeDebugInfo)
313 RAW_METHOD_DUMP(OS, get_overloadedOperator)
314 RAW_METHOD_DUMP(OS, get_hasSEH)
315 RAW_METHOD_DUMP(OS, get_hasSecurityChecks)
316 RAW_METHOD_DUMP(OS, get_hasSetJump)
317 RAW_METHOD_DUMP(OS, get_strictGSCheck)
318 RAW_METHOD_DUMP(OS, get_isAcceleratorGroupSharedLocal)
319 RAW_METHOD_DUMP(OS, get_isAcceleratorPointerTagLiveRange)
320 RAW_METHOD_DUMP(OS, get_isAcceleratorStubFunction)
321 RAW_METHOD_DUMP(OS, get_isAggregated)
322 RAW_METHOD_DUMP(OS, get_intro)
323 RAW_METHOD_DUMP(OS, get_isCVTCIL)
324 RAW_METHOD_DUMP(OS, get_isConstructorVirtualBase)
325 RAW_METHOD_DUMP(OS, get_isCxxReturnUdt)
326 RAW_METHOD_DUMP(OS, get_isDataAligned)
327 RAW_METHOD_DUMP(OS, get_isHLSLData)
328 RAW_METHOD_DUMP(OS, get_isHotpatchable)
329 RAW_METHOD_DUMP(OS, get_indirectVirtualBaseClass)
330 RAW_METHOD_DUMP(OS, get_isInterfaceUdt)
331 RAW_METHOD_DUMP(OS, get_intrinsic)
332 RAW_METHOD_DUMP(OS, get_isLTCG)
333 RAW_METHOD_DUMP(OS, get_isLocationControlFlowDependent)
334 RAW_METHOD_DUMP(OS, get_isMSILNetmodule)
335 RAW_METHOD_DUMP(OS, get_isMatrixRowMajor)
336 RAW_METHOD_DUMP(OS, get_managed)
337 RAW_METHOD_DUMP(OS, get_msil)
338 RAW_METHOD_DUMP(OS, get_isMultipleInheritance)
339 RAW_METHOD_DUMP(OS, get_isNaked)
340 RAW_METHOD_DUMP(OS, get_nested)
341 RAW_METHOD_DUMP(OS, get_isOptimizedAway)
342 RAW_METHOD_DUMP(OS, get_packed)
343 RAW_METHOD_DUMP(OS, get_isPointerBasedOnSymbolValue)
344 RAW_METHOD_DUMP(OS, get_isPointerToDataMember)
345 RAW_METHOD_DUMP(OS, get_isPointerToMemberFunction)
346 RAW_METHOD_DUMP(OS, get_pure)
347 RAW_METHOD_DUMP(OS, get_RValueReference)
348 RAW_METHOD_DUMP(OS, get_isRefUdt)
349 RAW_METHOD_DUMP(OS, get_reference)
350 RAW_METHOD_DUMP(OS, get_restrictedType)
351 RAW_METHOD_DUMP(OS, get_isReturnValue)
352 RAW_METHOD_DUMP(OS, get_isSafeBuffers)
353 RAW_METHOD_DUMP(OS, get_scoped)
354 RAW_METHOD_DUMP(OS, get_isSdl)
355 RAW_METHOD_DUMP(OS, get_isSingleInheritance)
356 RAW_METHOD_DUMP(OS, get_isSplitted)
357 RAW_METHOD_DUMP(OS, get_isStatic)
358 RAW_METHOD_DUMP(OS, get_isStripped)
359 RAW_METHOD_DUMP(OS, get_unalignedType)
360 RAW_METHOD_DUMP(OS, get_notReached)
361 RAW_METHOD_DUMP(OS, get_isValueUdt)
362 RAW_METHOD_DUMP(OS, get_virtual)
363 RAW_METHOD_DUMP(OS, get_virtualBaseClass)
364 RAW_METHOD_DUMP(OS, get_isVirtualInheritance)
365 RAW_METHOD_DUMP(OS, get_volatileType)
366 RAW_METHOD_DUMP(OS, get_wasInlined)
367 RAW_METHOD_DUMP(OS, get_unused)
368 RAW_METHOD_DUMP(OS, get_value)
369 }
370
371 std::unique_ptr
372 DIARawSymbol::findChildren(PDB_SymType Type) const {
197 RAW_METHOD_DUMP(OS, symIndexId) RAW_METHOD_DUMP(OS, symTag)
198
199 RAW_METHOD_DUMP(OS, access) RAW_METHOD_DUMP(
200 OS,
201 addressOffset) RAW_METHOD_DUMP(OS,
202 addressSection) RAW_METHOD_DUMP(OS,
203 age)
204 RAW_METHOD_DUMP(OS, arrayIndexTypeId) RAW_METHOD_DUMP(
205 OS, backEndMajor) RAW_METHOD_DUMP(OS, backEndMinor)
206 RAW_METHOD_DUMP(OS, backEndBuild) RAW_METHOD_DUMP(
207 OS, backEndQFE) RAW_METHOD_DUMP(OS, baseDataOffset)
208 RAW_METHOD_DUMP(OS, baseDataSlot) RAW_METHOD_DUMP(
209 OS, baseSymbolId) RAW_METHOD_DUMP(OS, baseType)
210 RAW_METHOD_DUMP(OS, bitPosition) RAW_METHOD_DUMP(
211 OS,
212 callingConvention) RAW_METHOD_DUMP(OS,
213 classParentId)
214 RAW_METHOD_DUMP(OS, compilerName) RAW_METHOD_DUMP(
215 OS, count) RAW_METHOD_DUMP(OS, countLiveRanges)
216 RAW_METHOD_DUMP(OS, frontEndMajor) RAW_METHOD_DUMP(
217 OS,
218 frontEndMinor) RAW_METHOD_DUMP(OS,
219 frontEndBuild)
220 RAW_METHOD_DUMP(OS, frontEndQFE) RAW_METHOD_DUMP(
221 OS,
222 lexicalParentId) RAW_METHOD_DUMP(OS,
223 libraryName)
224 RAW_METHOD_DUMP(
225 OS, liveRangeStartAddressOffset)
226 RAW_METHOD_DUMP(
227 OS,
228 liveRangeStartAddressSection)
229 RAW_METHOD_DUMP(
230 OS,
231 liveRangeStartRelativeVirtualAddress) RAW_METHOD_DUMP(OS, localBasePointerRegisterId) RAW_METHOD_DUMP(OS, lowerBoundId) RAW_METHOD_DUMP(OS, memorySpaceKind) RAW_METHOD_DUMP(OS, name) RAW_METHOD_DUMP(OS, numberOfAcceleratorPointerTags) RAW_METHOD_DUMP(OS, numberOfColumns) RAW_METHOD_DUMP(OS, numberOfModifiers) RAW_METHOD_DUMP(OS,
232 numberOfRegisterIndices) RAW_METHOD_DUMP(OS, numberOfRows) RAW_METHOD_DUMP(OS, objectFileName) RAW_METHOD_DUMP(OS, oemId) RAW_METHOD_DUMP(OS, oemSymbolId) RAW_METHOD_DUMP(OS, offsetInUdt) RAW_METHOD_DUMP(OS, platform) RAW_METHOD_DUMP(OS,
233 rank) RAW_METHOD_DUMP(OS, registerId) RAW_METHOD_DUMP(OS, registerType) RAW_METHOD_DUMP(OS, relativeVirtualAddress) RAW_METHOD_DUMP(OS, samplerSlot) RAW_METHOD_DUMP(OS, signature) RAW_METHOD_DUMP(OS, sizeInUdt) RAW_METHOD_DUMP(OS, slot) RAW_METHOD_DUMP(OS, sourceFileName) RAW_METHOD_DUMP(OS,
234 stride) RAW_METHOD_DUMP(OS,
235 subTypeId) RAW_METHOD_DUMP(OS,
236 symbolsFileName) RAW_METHOD_DUMP(OS,
237 targetOffset) RAW_METHOD_DUMP(OS,
238 targetRelativeVirtualAddress) RAW_METHOD_DUMP(OS,
239 targetVirtualAddress) RAW_METHOD_DUMP(OS,
240 targetSection) RAW_METHOD_DUMP(OS, textureSlot) RAW_METHOD_DUMP(OS, timeStamp) RAW_METHOD_DUMP(OS, token) RAW_METHOD_DUMP(OS,
241 typeId) RAW_METHOD_DUMP(OS,
242 uavSlot) RAW_METHOD_DUMP(OS,
243 undecoratedName) RAW_METHOD_DUMP(OS, unmodifiedTypeId) RAW_METHOD_DUMP(OS, upperBoundId) RAW_METHOD_DUMP(OS,
244 virtualBaseDispIndex) RAW_METHOD_DUMP(OS, virtualBaseOffset) RAW_METHOD_DUMP(OS, virtualTableShapeId) RAW_METHOD_DUMP(OS, dataKind) RAW_METHOD_DUMP(OS, guid) RAW_METHOD_DUMP(OS, offset) RAW_METHOD_DUMP(OS, thisAdjust) RAW_METHOD_DUMP(OS,
245 virtualBasePointerOffset) RAW_METHOD_DUMP(OS,
246 locationType) RAW_METHOD_DUMP(OS, machineType) RAW_METHOD_DUMP(OS, thunkOrdinal) RAW_METHOD_DUMP(OS, length) RAW_METHOD_DUMP(OS,
247 liveRangeLength) RAW_METHOD_DUMP(OS,
248 virtualAddress) RAW_METHOD_DUMP(OS,
249 udtKind) RAW_METHOD_DUMP(OS,
250 constructor) RAW_METHOD_DUMP(OS,
251 customCallingConvention) RAW_METHOD_DUMP(OS,
252 farReturn) RAW_METHOD_DUMP(OS,
253 code) RAW_METHOD_DUMP(OS,
254 compilerGenerated) RAW_METHOD_DUMP(OS, constType) RAW_METHOD_DUMP(OS, editAndContinueEnabled) RAW_METHOD_DUMP(OS, function) RAW_METHOD_DUMP(OS, stride) RAW_METHOD_DUMP(OS, noStackOrdering) RAW_METHOD_DUMP(OS, hasAlloca) RAW_METHOD_DUMP(OS, hasAssignmentOperator) RAW_METHOD_DUMP(OS, isCTypes) RAW_METHOD_DUMP(OS, hasCastOperator) RAW_METHOD_DUMP(OS, hasDebugInfo) RAW_METHOD_DUMP(OS, hasEH) RAW_METHOD_DUMP(OS, hasEHa) RAW_METHOD_DUMP(OS, hasInlAsm) RAW_METHOD_DUMP(OS,
255 framePointerPresent) RAW_METHOD_DUMP(OS,
256 inlSpec) RAW_METHOD_DUMP(OS,
257 interruptReturn) RAW_METHOD_DUMP(OS,
258 hasLongJump) RAW_METHOD_DUMP(OS, hasManagedCode) RAW_METHOD_DUMP(OS, hasNestedTypes) RAW_METHOD_DUMP(OS, noInline) RAW_METHOD_DUMP(OS, noReturn) RAW_METHOD_DUMP(OS, optimizedCodeDebugInfo) RAW_METHOD_DUMP(OS, overloadedOperator) RAW_METHOD_DUMP(OS, hasSEH) RAW_METHOD_DUMP(OS,
259 hasSecurityChecks) RAW_METHOD_DUMP(OS, hasSetJump) RAW_METHOD_DUMP(OS, strictGSCheck) RAW_METHOD_DUMP(OS, isAcceleratorGroupSharedLocal) RAW_METHOD_DUMP(OS, isAcceleratorPointerTagLiveRange) RAW_METHOD_DUMP(OS, isAcceleratorStubFunction)
260 RAW_METHOD_DUMP(OS, isAggregated) RAW_METHOD_DUMP(
261 OS,
262 intro) RAW_METHOD_DUMP(OS,
263 isCVTCIL)
264 RAW_METHOD_DUMP(OS, isConstructorVirtualBase) RAW_METHOD_DUMP(
265 OS,
266 isCxxReturnUdt) RAW_METHOD_DUMP(OS, isDataAligned)
267 RAW_METHOD_DUMP(OS, isHLSLData) RAW_METHOD_DUMP(
268 OS,
269 isHotpatchable)
270 RAW_METHOD_DUMP(
271 OS,
272 indirectVirtualBaseClass)
273 RAW_METHOD_DUMP(
274 OS,
275 isInterfaceUdt) RAW_METHOD_DUMP(OS,
276 intrinsic) RAW_METHOD_DUMP(OS,
277 isLTCG) RAW_METHOD_DUMP(OS, isLocationControlFlowDependent) RAW_METHOD_DUMP(OS, isMSILNetmodule) RAW_METHOD_DUMP(OS, isMatrixRowMajor) RAW_METHOD_DUMP(OS, managed) RAW_METHOD_DUMP(OS,
278 msil) RAW_METHOD_DUMP(OS,
279 isMultipleInheritance) RAW_METHOD_DUMP(OS, isNaked) RAW_METHOD_DUMP(OS, nested) RAW_METHOD_DUMP(OS, isOptimizedAway) RAW_METHOD_DUMP(OS, packed) RAW_METHOD_DUMP(OS, isPointerBasedOnSymbolValue) RAW_METHOD_DUMP(OS,
280 isPointerToDataMember) RAW_METHOD_DUMP(OS, isPointerToMemberFunction) RAW_METHOD_DUMP(OS,
281 pure) RAW_METHOD_DUMP(OS,
282 RValueReference) RAW_METHOD_DUMP(OS,
283 isRefUdt) RAW_METHOD_DUMP(OS,
284 reference) RAW_METHOD_DUMP(OS, restrictedType) RAW_METHOD_DUMP(OS, isReturnValue) RAW_METHOD_DUMP(OS, isSafeBuffers) RAW_METHOD_DUMP(OS, scoped) RAW_METHOD_DUMP(OS, isSdl) RAW_METHOD_DUMP(OS, isSingleInheritance)
285 RAW_METHOD_DUMP(OS, isSplitted) RAW_METHOD_DUMP(
286 OS,
287 isStatic) RAW_METHOD_DUMP(OS,
288 isStripped)
289 RAW_METHOD_DUMP(OS, unalignedType) RAW_METHOD_DUMP(
290 OS,
291 notReached) RAW_METHOD_DUMP(OS, isValueUdt)
292 RAW_METHOD_DUMP(OS, virtual) RAW_METHOD_DUMP(
293 OS,
294 virtualBaseClass)
295 RAW_METHOD_DUMP(
296 OS,
297 isVirtualInheritance)
298 RAW_METHOD_DUMP(
299 OS,
300 volatileType)
301 RAW_METHOD_DUMP(
302 OS,
303 wasInlined)
304 RAW_METHOD_DUMP(
305 OS,
306 unused)
307 RAW_METHOD_DUMP(
308 OS,
309 value)}
310
311 std::unique_ptr DIARawSymbol::findChildren(
312 PDB_SymType Type) const {
373313 enum SymTagEnum EnumVal = static_cast(Type);
374314
375315 CComPtr DiaEnumerator;
2020
2121 PDB_SymType NativeCompilandSymbol::getSymTag() const {
2222 return PDB_SymType::Compiland;
23 }
24
25 void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent) const {
26 NativeRawSymbol::dump(OS, Indent);
27
28 dumpSymbolField(OS, "baseType", static_cast(getBuiltinType()),
29 Indent);
30 dumpSymbolField(OS, "lexicalParentId", 0, Indent);
31 dumpSymbolField(OS, "libraryName", getLibraryName(), Indent);
32 dumpSymbolField(OS, "name", getName(), Indent);
33 dumpSymbolField(OS, "editAndContinueEnabled", isEditAndContinueEnabled(),
34 Indent);
2335 }
2436
2537 std::unique_ptr NativeCompilandSymbol::clone() const {
3939
4040 std::unique_ptr
4141 NativeEnumTypes::getChildAtIndex(uint32_t Index) const {
42 if (Index < Matches.size())
43 return Session.getSymbolCache().createEnumSymbol(Matches[Index]);
42 if (Index < Matches.size()) {
43 SymIndexId Id =
44 Session.getSymbolCache().findSymbolByTypeIndex(Matches[Index]);
45 return Session.getSymbolCache().getSymbolById(Id);
46 }
4447 return nullptr;
4548 }
4649
4646 }
4747 case PDB_SymType::Enum:
4848 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_ENUM);
49 case PDB_SymType::PointerType:
50 return Session.getSymbolCache().createTypeEnumerator(codeview::LF_POINTER);
4951 default:
5052 break;
5153 }
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
910 #include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
10 #include "llvm/DebugInfo/PDB/Native/NativeRawSymbol.h"
1111 #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
12 #include "llvm/Support/FormatVariadic.h"
1213
1314 using namespace llvm;
1415 using namespace llvm::pdb;
1718 SymIndexId SymbolId)
1819 : Session(PDBSession), Tag(Tag), SymbolId(SymbolId) {}
1920
20 void NativeRawSymbol::dump(raw_ostream &OS, int Indent) const {}
21 void NativeRawSymbol::dump(raw_ostream &OS, int Indent) const {
22 dumpSymbolField(OS, "symIndexId", SymbolId, Indent);
23 dumpSymbolField(OS, "symTag", static_cast(Tag), Indent);
24 }
2125
2226 std::unique_ptr
2327 NativeRawSymbol::findChildren(PDB_SymType Type) const {
77 //===----------------------------------------------------------------------===//
88
99 #include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
10 #include "llvm/Support/FormatVariadic.h"
1011
1112 namespace llvm {
1213 namespace pdb {
2324 }
2425
2526 void NativeTypeBuiltin::dump(raw_ostream &OS, int Indent) const {
26 // TODO: Apparently nothing needs this yet.
2727 }
2828
2929 PDB_SymType NativeTypeBuiltin::getSymTag() const {
1414 #include "llvm/DebugInfo/PDB/Native/SymbolCache.h"
1515 #include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
1616
17 #include "llvm/Support/FormatVariadic.h"
18
1719 #include
1820
1921 using namespace llvm;
22 using namespace llvm::codeview;
2023 using namespace llvm::pdb;
2124
2225 NativeTypeEnum::NativeTypeEnum(NativeSession &Session, SymIndexId Id,
2932
3033 NativeTypeEnum::~NativeTypeEnum() {}
3134
35 void NativeTypeEnum::dump(raw_ostream &OS, int Indent) const {
36 NativeRawSymbol::dump(OS, Indent);
37
38 dumpSymbolField(OS, "baseType", static_cast(getBuiltinType()),
39 Indent);
40 dumpSymbolField(OS, "lexicalParentId", 0, Indent);
41 dumpSymbolField(OS, "name", getName(), Indent);
42 dumpSymbolField(OS, "typeId", getTypeId(), Indent);
43 dumpSymbolField(OS, "length", getLength(), Indent);
44 dumpSymbolField(OS, "constructor", hasConstructor(), Indent);
45 dumpSymbolField(OS, "constType", isConstType(), Indent);
46 dumpSymbolField(OS, "hasAssignmentOperator", hasAssignmentOperator(), Indent);
47 dumpSymbolField(OS, "hasCastOperator", hasCastOperator(), Indent);
48 dumpSymbolField(OS, "hasNestedTypes", hasNestedTypes(), Indent);
49 dumpSymbolField(OS, "overloadedOperator", hasOverloadedOperator(), Indent);
50 dumpSymbolField(OS, "isInterfaceUdt", isInterfaceUdt(), Indent);
51 dumpSymbolField(OS, "intrinsic", isIntrinsic(), Indent);
52 dumpSymbolField(OS, "nested", isNested(), Indent);
53 dumpSymbolField(OS, "packed", isPacked(), Indent);
54 dumpSymbolField(OS, "isRefUdt", isRefUdt(), Indent);
55 dumpSymbolField(OS, "scoped", isScoped(), Indent);
56 dumpSymbolField(OS, "unalignedType", isUnalignedType(), Indent);
57 dumpSymbolField(OS, "isValueUdt", isValueUdt(), Indent);
58 dumpSymbolField(OS, "volatileType", isVolatileType(), Indent);
59 }
60
3261 std::unique_ptr NativeTypeEnum::clone() const {
3362 return llvm::make_unique(Session, SymbolId, CV);
3463 }
3766 NativeTypeEnum::findChildren(PDB_SymType Type) const {
3867 switch (Type) {
3968 case PDB_SymType::Data: {
40 // TODO(amccarth): Provide an actual implementation.
69 // TODO(amccarth) : Provide an actual implementation.
4170 return nullptr;
4271 }
4372 default:
5887
5988 PDB_SymType NativeTypeEnum::getSymTag() const { return PDB_SymType::Enum; }
6089
61 uint32_t NativeTypeEnum::getClassParentId() const { return 0xFFFFFFFF; }
62
63 uint32_t NativeTypeEnum::getUnmodifiedTypeId() const { return 0; }
90 PDB_BuiltinType NativeTypeEnum::getBuiltinType() const {
91 Session.getSymbolCache().findSymbolByTypeIndex(Record.getUnderlyingType());
92
93 codeview::TypeIndex Underlying = Record.getUnderlyingType();
94
95 // This indicates a corrupt record.
96 if (!Underlying.isSimple() ||
97 Underlying.getSimpleMode() != SimpleTypeMode::Direct)
98 return PDB_BuiltinType::None;
99
100 switch (Underlying.getSimpleKind()) {
101 case SimpleTypeKind::Boolean128:
102 case SimpleTypeKind::Boolean64:
103 case SimpleTypeKind::Boolean32:
104 case SimpleTypeKind::Boolean16:
105 case SimpleTypeKind::Boolean8:
106 return PDB_BuiltinType::Bool;
107 case SimpleTypeKind::NarrowCharacter:
108 case SimpleTypeKind::UnsignedCharacter:
109 return PDB_BuiltinType::Char;
110 case SimpleTypeKind::WideCharacter:
111 return PDB_BuiltinType::WCharT;
112 case SimpleTypeKind::Character16:
113 return PDB_BuiltinType::Char16;
114 case SimpleTypeKind::Character32:
115 return PDB_BuiltinType::Char32;
116 case SimpleTypeKind::Int128:
117 case SimpleTypeKind::Int128Oct:
118 case SimpleTypeKind::Int16:
119 case SimpleTypeKind::Int16Short:
120 case SimpleTypeKind::Int32:
121 case SimpleTypeKind::Int32Long:
122 case SimpleTypeKind::Int64:
123 case SimpleTypeKind::Int64Quad:
124 return PDB_BuiltinType::Int;
125 case SimpleTypeKind::UInt128:
126 case SimpleTypeKind::UInt128Oct:
127 case SimpleTypeKind::UInt16:
128 case SimpleTypeKind::UInt16Short:
129 case SimpleTypeKind::UInt32:
130 case SimpleTypeKind::UInt32Long:
131 case SimpleTypeKind::UInt64:
132 case SimpleTypeKind::UInt64Quad:
133 return PDB_BuiltinType::UInt;
134 case SimpleTypeKind::HResult:
135 return PDB_BuiltinType::HResult;
136 case SimpleTypeKind::Complex16:
137 case SimpleTypeKind::Complex32:
138 case SimpleTypeKind::Complex32PartialPrecision:
139 case SimpleTypeKind::Complex64:
140 case SimpleTypeKind::Complex80:
141 case SimpleTypeKind::Complex128:
142 return PDB_BuiltinType::Complex;
143 case SimpleTypeKind::Float16:
144 case SimpleTypeKind::Float32:
145 case SimpleTypeKind::Float32PartialPrecision:
146 case SimpleTypeKind::Float48:
147 case SimpleTypeKind::Float64:
148 case SimpleTypeKind::Float80:
149 case SimpleTypeKind::Float128:
150 return PDB_BuiltinType::Float;
151 default:
152 return PDB_BuiltinType::None;
153 }
154 llvm_unreachable("Unreachable");
155 }
156
157 uint32_t NativeTypeEnum::getUnmodifiedTypeId() const {
158 // FIXME: If this is const, volatile, or unaligned, we should return the
159 // SymIndexId of the unmodified type here.
160 return 0;
161 }
64162
65163 bool NativeTypeEnum::hasConstructor() const {
66164 return bool(Record.getOptions() &
70168 bool NativeTypeEnum::hasAssignmentOperator() const {
71169 return bool(Record.getOptions() &
72170 codeview::ClassOptions::HasOverloadedAssignmentOperator);
171 }
172
173 bool NativeTypeEnum::hasNestedTypes() const {
174 return bool(Record.getOptions() &
175 codeview::ClassOptions::ContainsNestedClass);
176 }
177
178 bool NativeTypeEnum::isIntrinsic() const {
179 return bool(Record.getOptions() & codeview::ClassOptions::Intrinsic);
73180 }
74181
75182 bool NativeTypeEnum::hasCastOperator() const {
108215 return Session.getSymbolCache().findSymbolByTypeIndex(
109216 Record.getUnderlyingType());
110217 }
218
219 bool NativeTypeEnum::isRefUdt() const { return false; }
220
221 bool NativeTypeEnum::isValueUdt() const { return false; }
222
223 bool NativeTypeEnum::isInterfaceUdt() const { return false; }
0 //===- NativeTypePointer.cpp - info about pointer type ----------*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/DebugInfo/PDB/Native/NativeTypePointer.h"
10
11 #include "llvm/DebugInfo/CodeView/TypeDeserializer.h"
12
13 #include
14
15 using namespace llvm;
16 using namespace llvm::codeview;
17 using namespace llvm::pdb;
18
19 NativeTypePointer::NativeTypePointer(NativeSession &Session, SymIndexId Id,
20 codeview::CVType CVT)
21 : NativeRawSymbol(Session, PDB_SymType::PointerType, Id),
22 Record(TypeRecordKind::Pointer) {
23 assert(CVT.kind() == TypeLeafKind::LF_POINTER);
24 cantFail(TypeDeserializer::deserializeAs(CVT, Record));
25 }
26
27 NativeTypePointer::NativeTypePointer(NativeSession &Session, SymIndexId Id,
28 PointerRecord PR)
29 : NativeRawSymbol(Session, PDB_SymType::PointerType, Id),
30 Record(std::move(PR)) {}
31
32 NativeTypePointer::~NativeTypePointer() {}
33
34 void NativeTypePointer::dump(raw_ostream &OS, int Indent) const {
35 NativeRawSymbol::dump(OS, Indent);
36
37 dumpSymbolField(OS, "lexicalParentId", 0, Indent);
38 dumpSymbolField(OS, "typeId", getTypeId(), Indent);
39 dumpSymbolField(OS, "length", getLength(), Indent);
40 dumpSymbolField(OS, "constType", isConstType(), Indent);
41 dumpSymbolField(OS, "isPointerToDataMember", isPointerToDataMember(), Indent);
42 dumpSymbolField(OS, "isPointerToMemberFunction", isPointerToMemberFunction(),
43 Indent);
44 dumpSymbolField(OS, "RValueReference", isRValueReference(), Indent);
45 dumpSymbolField(OS, "reference", isReference(), Indent);
46 dumpSymbolField(OS, "restrictedType", isRestrictedType(), Indent);
47 dumpSymbolField(OS, "unalignedType", isUnalignedType(), Indent);
48 dumpSymbolField(OS, "volatileType", isVolatileType(), Indent);
49 }
50
51 std::unique_ptr NativeTypePointer::clone() const {
52 return llvm::make_unique(Session, SymbolId, Record);
53 }
54
55 bool NativeTypePointer::isConstType() const { return false; }
56
57 uint64_t NativeTypePointer::getLength() const { return Record.getSize(); }
58
59 uint32_t NativeTypePointer::getTypeId() const {
60 // This is the pointee SymIndexId.
61 return Session.getSymbolCache().findSymbolByTypeIndex(Record.ReferentType);
62 }
63
64 bool NativeTypePointer::isReference() const {
65 return Record.getMode() == PointerMode::LValueReference ||
66 isRValueReference();
67 }
68
69 bool NativeTypePointer::isRValueReference() const {
70 return Record.getMode() == PointerMode::RValueReference;
71 }
72
73 bool NativeTypePointer::isPointerToDataMember() const {
74 return Record.getMode() == PointerMode::PointerToDataMember;
75 }
76
77 bool NativeTypePointer::isPointerToMemberFunction() const {
78 return Record.getMode() == PointerMode::PointerToMemberFunction;
79 }
80
81 bool NativeTypePointer::isRestrictedType() const { return false; }
82
83 bool NativeTypePointer::isVolatileType() const { return false; }
84
85 bool NativeTypePointer::isUnalignedType() const { return false; }
66 #include "llvm/DebugInfo/PDB/Native/NativeSession.h"
77 #include "llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h"
88 #include "llvm/DebugInfo/PDB/Native/NativeTypeEnum.h"
9 #include "llvm/DebugInfo/PDB/Native/NativeTypePointer.h"
910 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
1011 #include "llvm/DebugInfo/PDB/Native/TpiStream.h"
1112 #include "llvm/DebugInfo/PDB/PDBSymbol.h"
5960 }
6061 auto &Types = Tpi->typeCollection();
6162 return std::unique_ptr(
62 new NativeEnumTypes(Session, Types, codeview::LF_ENUM));
63 new NativeEnumTypes(Session, Types, Kind));
6364 }
6465
6566 SymIndexId SymbolCache::findSymbolByTypeIndex(codeview::TypeIndex Index) {
103104 case codeview::LF_ENUM:
104105 Id = createSymbol(CVT);
105106 break;
107 case codeview::LF_POINTER:
108 Id = createSymbol(CVT);
109 break;
106110 default:
107 assert(false && "Unsupported native symbol type!");
108 return 0;
111 Id = createSymbolPlaceholder();
112 break;
109113 }
110114 TypeIndexToSymbolId[Index] = Id;
111115 return Id;
113117
114118 std::unique_ptr
115119 SymbolCache::getSymbolById(SymIndexId SymbolId) const {
120 // Id 0 is reserved.
121 if (SymbolId == 0)
122 return nullptr;
123
116124 // If the caller has a SymbolId, it'd better be in our SymbolCache.
117125 return SymbolId < Cache.size() ? PDBSymbol::create(Session, *Cache[SymbolId])
118126 : nullptr;
22 ; RUN: | FileCheck -check-prefix=EMPTY %s
33 ; RUN: llvm-pdbutil pretty -native -compilands %p/../Inputs/big-read.pdb \
44 ; RUN: | FileCheck -check-prefix=BIGREAD %s
5 ; RUN: llvm-pdbutil diadump -compilands %p/../Inputs/empty.pdb \
6 ; RUN: | FileCheck -check-prefix=DUMP %s
57
68 ; Reference output was generated with the DIA reader to ensure that the
79 ; `-native` option produces identical output. The paths output will have
6264 BIGREAD: Import:api-ms-win-crt-heap-l1-1-0.dll
6365 BIGREAD: api-ms-win-crt-heap-l1-1-0.dll
6466 BIGREAD: * Linker *
67
68 DUMP: {
69 DUMP-NEXT: symIndexId: 1
70 DUMP-NEXT: symTag: 2
71 DUMP-NEXT: lexicalParentId: 2
72 DUMP-NEXT: libraryName: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
73 DUMP-NEXT: name: d:\src\llvm\test\DebugInfo\PDB\Inputs\empty.obj
74 DUMP-NEXT: editAndContinueEnabled: 0
75 DUMP-NEXT: }
76 DUMP-NEXT: {
77 DUMP-NEXT: symIndexId: 3
78 DUMP-NEXT: symTag: 2
79 DUMP-NEXT: lexicalParentId: 2
80 DUMP-NEXT: libraryName:
81 DUMP-NEXT: name: * Linker *
82 DUMP-NEXT: editAndContinueEnabled: 0
83 DUMP-NEXT: }
0 ; Test that the native PDB reader can enumerate the enum types.
11 ; RUN: llvm-pdbutil pretty -native -enums %p/../Inputs/every-type.pdb \
22 ; RUN: | FileCheck -check-prefix=ENUMS %s
3 ; RUN: llvm-pdbutil diadump -native -enums %p/../Inputs/every-type.pdb \
4 ; RUN: | FileCheck -check-prefix=DUMP %s
35
46 ENUMS: enum FooClass::NestedEnum {
57 ENUMS-NEXT: }
8
9 DUMP: {
10 DUMP-NEXT: symIndexId: 2
11 DUMP-NEXT: symTag: 12
12 DUMP-NEXT: baseType: 6
13 DUMP-NEXT: lexicalParentId: 0
14 DUMP-NEXT: name: __vc_attributes::event_sourceAttribute::type_e
15 DUMP-NEXT: typeId: 3
16 DUMP-NEXT: length: 4
17 DUMP-NEXT: constructor: 0
18 DUMP-NEXT: constType: 0
19 DUMP-NEXT: hasAssignmentOperator: 0
20 DUMP-NEXT: hasCastOperator: 0
21 DUMP-NEXT: hasNestedTypes: 0
22 DUMP-NEXT: overloadedOperator: 0
23 DUMP-NEXT: isInterfaceUdt: 0
24 DUMP-NEXT: intrinsic: 0
25 DUMP-NEXT: nested: 1
26 DUMP-NEXT: packed: 0
27 DUMP-NEXT: isRefUdt: 0
28 DUMP-NEXT: scoped: 0
29 DUMP-NEXT: unalignedType: 0
30 DUMP-NEXT: isValueUdt: 0
31 DUMP-NEXT: volatileType: 0
32 DUMP-NEXT: }
33 DUMP-NEXT: {
34 DUMP-NEXT: symIndexId: 4
35 DUMP-NEXT: symTag: 12
36 DUMP-NEXT: baseType: 6
37 DUMP-NEXT: lexicalParentId: 0
38 DUMP-NEXT: name: __vc_attributes::event_sourceAttribute::optimize_e
39 DUMP-NEXT: typeId: 3
40 DUMP-NEXT: length: 4
41 DUMP-NEXT: constructor: 0
42 DUMP-NEXT: constType: 0
43 DUMP-NEXT: hasAssignmentOperator: 0
44 DUMP-NEXT: hasCastOperator: 0
45 DUMP-NEXT: hasNestedTypes: 0
46 DUMP-NEXT: overloadedOperator: 0
47 DUMP-NEXT: isInterfaceUdt: 0
48 DUMP-NEXT: intrinsic: 0
49 DUMP-NEXT: nested: 1
50 DUMP-NEXT: packed: 0
51 DUMP-NEXT: isRefUdt: 0
52 DUMP-NEXT: scoped: 0
53 DUMP-NEXT: unalignedType: 0
54 DUMP-NEXT: isValueUdt: 0
55 DUMP-NEXT: volatileType: 0
56 DUMP-NEXT: }
57 DUMP-NEXT: {
58 DUMP-NEXT: symIndexId: 5
59 DUMP-NEXT: symTag: 12
60 DUMP-NEXT: baseType: 6
61 DUMP-NEXT: lexicalParentId: 0
62 DUMP-NEXT: name: __vc_attributes::helper_attributes::v1_alttypeAttribute::type_e
63 DUMP-NEXT: typeId: 3
64 DUMP-NEXT: length: 4
65 DUMP-NEXT: constructor: 0
66 DUMP-NEXT: constType: 0
67 DUMP-NEXT: hasAssignmentOperator: 0
68 DUMP-NEXT: hasCastOperator: 0
69 DUMP-NEXT: hasNestedTypes: 0
70 DUMP-NEXT: overloadedOperator: 0
71 DUMP-NEXT: isInterfaceUdt: 0
72 DUMP-NEXT: intrinsic: 0
73 DUMP-NEXT: nested: 1
74 DUMP-NEXT: packed: 0
75 DUMP-NEXT: isRefUdt: 0
76 DUMP-NEXT: scoped: 0
77 DUMP-NEXT: unalignedType: 0
78 DUMP-NEXT: isValueUdt: 0
79 DUMP-NEXT: volatileType: 0
80 DUMP-NEXT: }
81 DUMP-NEXT: {
82 DUMP-NEXT: symIndexId: 6
83 DUMP-NEXT: symTag: 12
84 DUMP-NEXT: baseType: 6
85 DUMP-NEXT: lexicalParentId: 0
86 DUMP-NEXT: name: __vc_attributes::helper_attributes::usageAttribute::usage_e
87 DUMP-NEXT: typeId: 3
88 DUMP-NEXT: length: 4
89 DUMP-NEXT: constructor: 0
90 DUMP-NEXT: constType: 0
91 DUMP-NEXT: hasAssignmentOperator: 0
92 DUMP-NEXT: hasCastOperator: 0
93 DUMP-NEXT: hasNestedTypes: 0
94 DUMP-NEXT: overloadedOperator: 0
95 DUMP-NEXT: isInterfaceUdt: 0
96 DUMP-NEXT: intrinsic: 0
97 DUMP-NEXT: nested: 1
98 DUMP-NEXT: packed: 0
99 DUMP-NEXT: isRefUdt: 0
100 DUMP-NEXT: scoped: 0
101 DUMP-NEXT: unalignedType: 0
102 DUMP-NEXT: isValueUdt: 0
103 DUMP-NEXT: volatileType: 0
104 DUMP-NEXT: }
105 DUMP-NEXT: {
106 DUMP-NEXT: symIndexId: 7
107 DUMP-NEXT: symTag: 12
108 DUMP-NEXT: baseType: 6
109 DUMP-NEXT: lexicalParentId: 0
110 DUMP-NEXT: name: __vc_attributes::threadingAttribute::threading_e
111 DUMP-NEXT: typeId: 3
112 DUMP-NEXT: length: 4
113 DUMP-NEXT: constructor: 0
114 DUMP-NEXT: constType: 0
115 DUMP-NEXT: hasAssignmentOperator: 0
116 DUMP-NEXT: hasCastOperator: 0
117 DUMP-NEXT: hasNestedTypes: 0
118 DUMP-NEXT: overloadedOperator: 0
119 DUMP-NEXT: isInterfaceUdt: 0
120 DUMP-NEXT: intrinsic: 0
121 DUMP-NEXT: nested: 1
122 DUMP-NEXT: packed: 0
123 DUMP-NEXT: isRefUdt: 0
124 DUMP-NEXT: scoped: 0
125 DUMP-NEXT: unalignedType: 0
126 DUMP-NEXT: isValueUdt: 0
127 DUMP-NEXT: volatileType: 0
128 DUMP-NEXT: }
129 DUMP-NEXT: {
130 DUMP-NEXT: symIndexId: 8
131 DUMP-NEXT: symTag: 12
132 DUMP-NEXT: baseType: 6
133 DUMP-NEXT: lexicalParentId: 0
134 DUMP-NEXT: name: __vc_attributes::aggregatableAttribute::type_e
135 DUMP-NEXT: typeId: 3
136 DUMP-NEXT: length: 4
137 DUMP-NEXT: constructor: 0
138 DUMP-NEXT: constType: 0
139 DUMP-NEXT: hasAssignmentOperator: 0
140 DUMP-NEXT: hasCastOperator: 0
141 DUMP-NEXT: hasNestedTypes: 0
142 DUMP-NEXT: overloadedOperator: 0
143 DUMP-NEXT: isInterfaceUdt: 0
144 DUMP-NEXT: intrinsic: 0
145 DUMP-NEXT: nested: 1
146 DUMP-NEXT: packed: 0
147 DUMP-NEXT: isRefUdt: 0
148 DUMP-NEXT: scoped: 0
149 DUMP-NEXT: unalignedType: 0
150 DUMP-NEXT: isValueUdt: 0
151 DUMP-NEXT: volatileType: 0
152 DUMP-NEXT: }
153 DUMP-NEXT: {
154 DUMP-NEXT: symIndexId: 9
155 DUMP-NEXT: symTag: 12
156 DUMP-NEXT: baseType: 6
157 DUMP-NEXT: lexicalParentId: 0
158 DUMP-NEXT: name: __vc_attributes::event_receiverAttribute::type_e
159 DUMP-NEXT: typeId: 3
160 DUMP-NEXT: length: 4
161 DUMP-NEXT: constructor: 0
162 DUMP-NEXT: constType: 0
163 DUMP-NEXT: hasAssignmentOperator: 0
164 DUMP-NEXT: hasCastOperator: 0
165 DUMP-NEXT: hasNestedTypes: 0
166 DUMP-NEXT: overloadedOperator: 0
167 DUMP-NEXT: isInterfaceUdt: 0
168 DUMP-NEXT: intrinsic: 0
169 DUMP-NEXT: nested: 1
170 DUMP-NEXT: packed: 0
171 DUMP-NEXT: isRefUdt: 0
172 DUMP-NEXT: scoped: 0
173 DUMP-NEXT: unalignedType: 0
174 DUMP-NEXT: isValueUdt: 0
175 DUMP-NEXT: volatileType: 0
176 DUMP-NEXT: }
177 DUMP-NEXT: {
178 DUMP-NEXT: symIndexId: 10
179 DUMP-NEXT: symTag: 12
180 DUMP-NEXT: baseType: 6
181 DUMP-NEXT: lexicalParentId: 0
182 DUMP-NEXT: name: __vc_attributes::moduleAttribute::type_e
183 DUMP-NEXT: typeId: 3
184 DUMP-NEXT: length: 4
185 DUMP-NEXT: constructor: 0
186 DUMP-NEXT: constType: 0
187 DUMP-NEXT: hasAssignmentOperator: 0
188 DUMP-NEXT: hasCastOperator: 0
189 DUMP-NEXT: hasNestedTypes: 0
190 DUMP-NEXT: overloadedOperator: 0
191 DUMP-NEXT: isInterfaceUdt: 0
192 DUMP-NEXT: intrinsic: 0
193 DUMP-NEXT: nested: 1
194 DUMP-NEXT: packed: 0
195 DUMP-NEXT: isRefUdt: 0
196 DUMP-NEXT: scoped: 0
197 DUMP-NEXT: unalignedType: 0
198 DUMP-NEXT: isValueUdt: 0
199 DUMP-NEXT: volatileType: 0
200 DUMP-NEXT: }
201 DUMP-NEXT: {
202 DUMP-NEXT: symIndexId: 11
203 DUMP-NEXT: symTag: 12
204 DUMP-NEXT: baseType: 6
205 DUMP-NEXT: lexicalParentId: 0
206 DUMP-NEXT: name: FooClass::NestedEnum
207 DUMP-NEXT: typeId: 3
208 DUMP-NEXT: length: 4
209 DUMP-NEXT: constructor: 0
210 DUMP-NEXT: constType: 0
211 DUMP-NEXT: hasAssignmentOperator: 0
212 DUMP-NEXT: hasCastOperator: 0
213 DUMP-NEXT: hasNestedTypes: 0
214 DUMP-NEXT: overloadedOperator: 0
215 DUMP-NEXT: isInterfaceUdt: 0
216 DUMP-NEXT: intrinsic: 0
217 DUMP-NEXT: nested: 1
218 DUMP-NEXT: packed: 0
219 DUMP-NEXT: isRefUdt: 0
220 DUMP-NEXT: scoped: 0
221 DUMP-NEXT: unalignedType: 0
222 DUMP-NEXT: isValueUdt: 0
223 DUMP-NEXT: volatileType: 0
224 DUMP-NEXT: }
100100 cl::SubCommand DumpSubcommand("dump", "Dump MSF and CodeView debug info");
101101 cl::SubCommand BytesSubcommand("bytes", "Dump raw bytes from the PDB file");
102102
103 cl::SubCommand DiaDumpSubcommand("diadump",
104 "Dump debug information using a DIA-like API");
105
103106 cl::SubCommand
104107 PrettySubcommand("pretty",
105108 "Dump semantic information about types and symbols");
152155 clEnumValN(ModuleSubsection::Unknown, "unknown",
153156 "Any subsection not covered by another option"),
154157 clEnumValN(ModuleSubsection::All, "all", "All known subsections"));
158
159 namespace diadump {
160 cl::list InputFilenames(cl::Positional,
161 cl::desc(""),
162 cl::OneOrMore, cl::sub(DiaDumpSubcommand));
163
164 cl::opt Native("native", cl::desc("Use native PDB reader instead of DIA"),
165 cl::sub(DiaDumpSubcommand));
166
167 static cl::opt Enums("enums", cl::desc("Dump enum types"),
168 cl::sub(DiaDumpSubcommand));
169 static cl::opt Pointers("pointers", cl::desc("Dump enum types"),
170 cl::sub(DiaDumpSubcommand));
171 static cl::opt Compilands("compilands",
172 cl::desc("Dump compiland information"),
173 cl::sub(DiaDumpSubcommand));
174 } // namespace diadump
155175
156176 namespace pretty {
157177 cl::list InputFilenames(cl::Positional,
919939
920940 // Re-indent back to the original level.
921941 Printer.Indent(Indent);
942 }
943 }
944
945 static void dumpDia(StringRef Path) {
946 std::unique_ptr Session;
947
948 const auto ReaderType =
949 opts::diadump::Native ? PDB_ReaderType::Native : PDB_ReaderType::DIA;
950 ExitOnErr(loadDataForPDB(ReaderType, Path, Session));
951
952 auto GlobalScope = Session->getGlobalScope();
953
954 std::vector SymTypes;
955
956 if (opts::diadump::Compilands)
957 SymTypes.push_back(PDB_SymType::Compiland);
958 if (opts::diadump::Enums)
959 SymTypes.push_back(PDB_SymType::Enum);
960 if (opts::diadump::Pointers)
961 SymTypes.push_back(PDB_SymType::PointerType);
962
963 for (PDB_SymType ST : SymTypes) {
964 auto Children = GlobalScope->findAllChildren(ST);
965 while (auto Child = Children->getNext()) {
966 outs() << "{";
967 Child->defaultDump(outs(), 2);
968 outs() << "\n}\n";
969 }
922970 }
923971 }
924972
13841432 yamlToPdb(opts::yaml2pdb::InputFilename);
13851433 } else if (opts::AnalyzeSubcommand) {
13861434 dumpAnalysis(opts::analyze::InputFilename.front());
1435 } else if (opts::DiaDumpSubcommand) {
1436 llvm::for_each(opts::diadump::InputFilenames, dumpDia);
13871437 } else if (opts::PrettySubcommand) {
13881438 if (opts::pretty::Lines)
13891439 opts::pretty::Compilands = true;