1 //===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
11 #define LLVM_DEBUGINFO_PDB_PDBTYPES_H
13 #include "llvm/DebugInfo/CodeView/CodeView.h"
14 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
15 #include "llvm/DebugInfo/PDB/IPDBFrameData.h"
16 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
26 typedef uint32_t SymIndexId;
29 class IPDBInjectedSource;
31 class IPDBSectionContrib;
37 class PDBSymbolCompiland;
38 class PDBSymbolCompilandDetails;
39 class PDBSymbolCompilandEnv;
43 class PDBSymbolAnnotation;
45 class PDBSymbolPublicSymbol;
46 class PDBSymbolTypeUDT;
47 class PDBSymbolTypeEnum;
48 class PDBSymbolTypeFunctionSig;
49 class PDBSymbolTypePointer;
50 class PDBSymbolTypeArray;
51 class PDBSymbolTypeBuiltin;
52 class PDBSymbolTypeTypedef;
53 class PDBSymbolTypeBaseClass;
54 class PDBSymbolTypeFriend;
55 class PDBSymbolTypeFunctionArg;
56 class PDBSymbolFuncDebugStart;
57 class PDBSymbolFuncDebugEnd;
58 class PDBSymbolUsingNamespace;
59 class PDBSymbolTypeVTableShape;
60 class PDBSymbolTypeVTable;
61 class PDBSymbolCustom;
63 class PDBSymbolTypeCustom;
64 class PDBSymbolTypeManaged;
65 class PDBSymbolTypeDimension;
66 class PDBSymbolUnknown;
68 using IPDBEnumSymbols = IPDBEnumChildren<PDBSymbol>;
69 using IPDBEnumSourceFiles = IPDBEnumChildren<IPDBSourceFile>;
70 using IPDBEnumDataStreams = IPDBEnumChildren<IPDBDataStream>;
71 using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
72 using IPDBEnumTables = IPDBEnumChildren<IPDBTable>;
73 using IPDBEnumInjectedSources = IPDBEnumChildren<IPDBInjectedSource>;
74 using IPDBEnumSectionContribs = IPDBEnumChildren<IPDBSectionContrib>;
75 using IPDBEnumFrameData = IPDBEnumChildren<IPDBFrameData>;
77 /// Specifies which PDB reader implementation is to be used. Only a value
78 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
79 enum class PDB_ReaderType {
84 /// An enumeration indicating the type of data contained in this table.
85 enum class PDB_TableType {
98 /// Defines flags used for enumerating child symbols. This corresponds to the
99 /// NameSearchOptions enumeration which is documented here:
100 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
101 enum PDB_NameSearchFlags {
103 NS_CaseSensitive = 0x1,
104 NS_CaseInsensitive = 0x2,
105 NS_FileNameExtMatch = 0x4,
107 NS_UndecoratedName = 0x10,
109 // For backward compatibility.
110 NS_CaseInFileNameExt = NS_CaseInsensitive | NS_FileNameExtMatch,
111 NS_CaseRegex = NS_Regex | NS_CaseSensitive,
112 NS_CaseInRex = NS_Regex | NS_CaseInsensitive
115 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
116 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
117 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
118 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2, SHA256 = 3 };
120 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
121 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
122 using PDB_Cpu = codeview::CPUType;
124 enum class PDB_Machine {
149 enum class PDB_SourceCompression {
156 /// These values correspond to the CV_call_e enumeration, and are documented
157 /// at the following locations:
158 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
159 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
160 using PDB_CallingConv = codeview::CallingConvention;
162 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
163 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
164 using PDB_Lang = codeview::SourceLanguage;
166 /// These values correspond to the DataKind enumeration, and are documented
167 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
168 enum class PDB_DataKind {
181 /// These values correspond to the SymTagEnum enumeration, and are documented
182 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
183 enum class PDB_SymType {
230 /// These values correspond to the LocationType enumeration, and are documented
231 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
232 enum class PDB_LocType {
248 /// These values correspond to the UdtKind enumeration, and are documented
249 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
250 enum class PDB_UdtType { Struct, Class, Union, Interface };
252 /// These values correspond to the StackFrameTypeEnum enumeration, and are
253 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
254 enum class PDB_StackFrameType : uint16_t {
263 /// These values correspond to the MemoryTypeEnum enumeration, and are
264 /// documented here: https://msdn.microsoft.com/en-us/library/ms165609.aspx.
265 enum class PDB_MemoryType : uint16_t {
273 /// These values correspond to the Basictype enumeration, and are documented
274 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
275 enum class PDB_BuiltinType {
298 /// These values correspond to the flags that can be combined to control the
299 /// return of an undecorated name for a C++ decorated name, and are documented
300 /// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx
301 enum PDB_UndnameFlags : uint32_t {
302 Undname_Complete = 0x0,
303 Undname_NoLeadingUnderscores = 0x1,
304 Undname_NoMsKeywords = 0x2,
305 Undname_NoFuncReturns = 0x4,
306 Undname_NoAllocModel = 0x8,
307 Undname_NoAllocLang = 0x10,
308 Undname_Reserved1 = 0x20,
309 Undname_Reserved2 = 0x40,
310 Undname_NoThisType = 0x60,
311 Undname_NoAccessSpec = 0x80,
312 Undname_NoThrowSig = 0x100,
313 Undname_NoMemberType = 0x200,
314 Undname_NoReturnUDTModel = 0x400,
315 Undname_32BitDecode = 0x800,
316 Undname_NameOnly = 0x1000,
317 Undname_TypeOnly = 0x2000,
318 Undname_HaveParams = 0x4000,
319 Undname_NoECSU = 0x8000,
320 Undname_NoIdentCharCheck = 0x10000,
321 Undname_NoPTR64 = 0x20000
324 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
333 enum PDB_VariantType {
353 explicit Variant(bool V) : Type(PDB_VariantType::Bool) { Value.Bool = V; }
354 explicit Variant(int8_t V) : Type(PDB_VariantType::Int8) { Value.Int8 = V; }
355 explicit Variant(int16_t V) : Type(PDB_VariantType::Int16) {
358 explicit Variant(int32_t V) : Type(PDB_VariantType::Int32) {
361 explicit Variant(int64_t V) : Type(PDB_VariantType::Int64) {
364 explicit Variant(float V) : Type(PDB_VariantType::Single) {
367 explicit Variant(double V) : Type(PDB_VariantType::Double) {
370 explicit Variant(uint8_t V) : Type(PDB_VariantType::UInt8) {
373 explicit Variant(uint16_t V) : Type(PDB_VariantType::UInt16) {
376 explicit Variant(uint32_t V) : Type(PDB_VariantType::UInt32) {
379 explicit Variant(uint64_t V) : Type(PDB_VariantType::UInt64) {
383 Variant(const Variant &Other) {
388 if (Type == PDB_VariantType::String)
389 delete[] Value.String;
392 PDB_VariantType Type = PDB_VariantType::Empty;
408 #define VARIANT_EQUAL_CASE(Enum) \
409 case PDB_VariantType::Enum: \
410 return Value.Enum == Other.Value.Enum;
412 bool operator==(const Variant &Other) const {
413 if (Type != Other.Type)
416 VARIANT_EQUAL_CASE(Bool)
417 VARIANT_EQUAL_CASE(Int8)
418 VARIANT_EQUAL_CASE(Int16)
419 VARIANT_EQUAL_CASE(Int32)
420 VARIANT_EQUAL_CASE(Int64)
421 VARIANT_EQUAL_CASE(Single)
422 VARIANT_EQUAL_CASE(Double)
423 VARIANT_EQUAL_CASE(UInt8)
424 VARIANT_EQUAL_CASE(UInt16)
425 VARIANT_EQUAL_CASE(UInt32)
426 VARIANT_EQUAL_CASE(UInt64)
427 VARIANT_EQUAL_CASE(String)
433 #undef VARIANT_EQUAL_CASE
435 bool operator!=(const Variant &Other) const { return !(*this == Other); }
436 Variant &operator=(const Variant &Other) {
439 if (Type == PDB_VariantType::String)
440 delete[] Value.String;
443 if (Other.Type == PDB_VariantType::String &&
444 Other.Value.String != nullptr) {
445 Value.String = new char[strlen(Other.Value.String) + 1];
446 ::strcpy(Value.String, Other.Value.String);
452 } // end namespace pdb
453 } // end namespace llvm
457 template <> struct hash<llvm::pdb::PDB_SymType> {
458 using argument_type = llvm::pdb::PDB_SymType;
459 using result_type = std::size_t;
461 result_type operator()(const argument_type &Arg) const {
462 return std::hash<int>()(static_cast<int>(Arg));
466 } // end namespace std
468 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H