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/Native/RawTypes.h"
32 class PDBSymbolCompiland;
33 class PDBSymbolCompilandDetails;
34 class PDBSymbolCompilandEnv;
38 class PDBSymbolAnnotation;
40 class PDBSymbolPublicSymbol;
41 class PDBSymbolTypeUDT;
42 class PDBSymbolTypeEnum;
43 class PDBSymbolTypeFunctionSig;
44 class PDBSymbolTypePointer;
45 class PDBSymbolTypeArray;
46 class PDBSymbolTypeBuiltin;
47 class PDBSymbolTypeTypedef;
48 class PDBSymbolTypeBaseClass;
49 class PDBSymbolTypeFriend;
50 class PDBSymbolTypeFunctionArg;
51 class PDBSymbolFuncDebugStart;
52 class PDBSymbolFuncDebugEnd;
53 class PDBSymbolUsingNamespace;
54 class PDBSymbolTypeVTableShape;
55 class PDBSymbolTypeVTable;
56 class PDBSymbolCustom;
58 class PDBSymbolTypeCustom;
59 class PDBSymbolTypeManaged;
60 class PDBSymbolTypeDimension;
61 class PDBSymbolUnknown;
63 using IPDBEnumSymbols = IPDBEnumChildren<PDBSymbol>;
64 using IPDBEnumSourceFiles = IPDBEnumChildren<IPDBSourceFile>;
65 using IPDBEnumDataStreams = IPDBEnumChildren<IPDBDataStream>;
66 using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
67 using IPDBEnumTables = IPDBEnumChildren<IPDBTable>;
69 /// Specifies which PDB reader implementation is to be used. Only a value
70 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
71 enum class PDB_ReaderType {
76 /// An enumeration indicating the type of data contained in this table.
77 enum class PDB_TableType {
90 /// Defines flags used for enumerating child symbols. This corresponds to the
91 /// NameSearchOptions enumeration which is documented here:
92 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
93 enum PDB_NameSearchFlags {
95 NS_CaseSensitive = 0x1,
96 NS_CaseInsensitive = 0x2,
97 NS_FileNameExtMatch = 0x4,
99 NS_UndecoratedName = 0x10
102 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
103 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
104 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
105 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
107 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
108 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
109 using PDB_Cpu = codeview::CPUType;
111 enum class PDB_Machine {
136 /// These values correspond to the CV_call_e enumeration, and are documented
137 /// at the following locations:
138 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
139 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
140 using PDB_CallingConv = codeview::CallingConvention;
142 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
143 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
144 using PDB_Lang = codeview::SourceLanguage;
146 /// These values correspond to the DataKind enumeration, and are documented
147 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
148 enum class PDB_DataKind {
161 /// These values correspond to the SymTagEnum enumeration, and are documented
162 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
163 enum class PDB_SymType {
198 /// These values correspond to the LocationType enumeration, and are documented
199 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
200 enum class PDB_LocType {
215 /// These values correspond to the UdtKind enumeration, and are documented
216 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
217 enum class PDB_UdtType { Struct, Class, Union, Interface };
219 /// These values correspond to the StackFrameTypeEnum enumeration, and are
220 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
221 enum class PDB_StackFrameType { FPO, KernelTrap, KernelTSS, EBP, FrameData };
223 /// These values correspond to the StackFrameTypeEnum enumeration, and are
224 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
225 enum class PDB_MemoryType { Code, Data, Stack, HeapCode };
227 /// These values correspond to the Basictype enumeration, and are documented
228 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
229 enum class PDB_BuiltinType {
250 /// These values correspond to the flags that can be combined to control the
251 /// return of an undecorated name for a C++ decorated name, and are documented
252 /// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx
253 enum PDB_UndnameFlags: uint32_t {
254 Undname_Complete = 0x0,
255 Undname_NoLeadingUnderscores = 0x1,
256 Undname_NoMsKeywords = 0x2,
257 Undname_NoFuncReturns = 0x4,
258 Undname_NoAllocModel = 0x8,
259 Undname_NoAllocLang = 0x10,
260 Undname_Reserved1 = 0x20,
261 Undname_Reserved2 = 0x40,
262 Undname_NoThisType = 0x60,
263 Undname_NoAccessSpec = 0x80,
264 Undname_NoThrowSig = 0x100,
265 Undname_NoMemberType = 0x200,
266 Undname_NoReturnUDTModel = 0x400,
267 Undname_32BitDecode = 0x800,
268 Undname_NameOnly = 0x1000,
269 Undname_TypeOnly = 0x2000,
270 Undname_HaveParams = 0x4000,
271 Undname_NoECSU = 0x8000,
272 Undname_NoIdentCharCheck = 0x10000,
273 Undname_NoPTR64 = 0x20000
276 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
285 enum PDB_VariantType {
305 Variant(const Variant &Other) {
310 if (Type == PDB_VariantType::String)
311 delete[] Value.String;
314 PDB_VariantType Type = PDB_VariantType::Empty;
330 #define VARIANT_EQUAL_CASE(Enum) \
331 case PDB_VariantType::Enum: \
332 return Value.Enum == Other.Value.Enum;
334 bool operator==(const Variant &Other) const {
335 if (Type != Other.Type)
338 VARIANT_EQUAL_CASE(Bool)
339 VARIANT_EQUAL_CASE(Int8)
340 VARIANT_EQUAL_CASE(Int16)
341 VARIANT_EQUAL_CASE(Int32)
342 VARIANT_EQUAL_CASE(Int64)
343 VARIANT_EQUAL_CASE(Single)
344 VARIANT_EQUAL_CASE(Double)
345 VARIANT_EQUAL_CASE(UInt8)
346 VARIANT_EQUAL_CASE(UInt16)
347 VARIANT_EQUAL_CASE(UInt32)
348 VARIANT_EQUAL_CASE(UInt64)
349 VARIANT_EQUAL_CASE(String)
355 #undef VARIANT_EQUAL_CASE
357 bool operator!=(const Variant &Other) const { return !(*this == Other); }
358 Variant &operator=(const Variant &Other) {
361 if (Type == PDB_VariantType::String)
362 delete[] Value.String;
365 if (Other.Type == PDB_VariantType::String &&
366 Other.Value.String != nullptr) {
367 Value.String = new char[strlen(Other.Value.String) + 1];
368 ::strcpy(Value.String, Other.Value.String);
374 } // end namespace pdb
375 } // end namespace llvm
379 template <> struct hash<llvm::pdb::PDB_SymType> {
380 using argument_type = llvm::pdb::PDB_SymType;
381 using result_type = std::size_t;
383 result_type operator()(const argument_type &Arg) const {
384 return std::hash<int>()(static_cast<int>(Arg));
388 } // end namespace std
390 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H