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/Config/llvm-config.h"
14 #include "llvm/DebugInfo/CodeView/CodeView.h"
15 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
27 template <class T> class IPDBEnumChildren;
33 typedef IPDBEnumChildren<PDBSymbol> IPDBEnumSymbols;
34 typedef IPDBEnumChildren<IPDBSourceFile> IPDBEnumSourceFiles;
35 typedef IPDBEnumChildren<IPDBDataStream> IPDBEnumDataStreams;
36 typedef IPDBEnumChildren<IPDBLineNumber> IPDBEnumLineNumbers;
39 class PDBSymbolCompiland;
40 class PDBSymbolCompilandDetails;
41 class PDBSymbolCompilandEnv;
45 class PDBSymbolAnnotation;
47 class PDBSymbolPublicSymbol;
48 class PDBSymbolTypeUDT;
49 class PDBSymbolTypeEnum;
50 class PDBSymbolTypeFunctionSig;
51 class PDBSymbolTypePointer;
52 class PDBSymbolTypeArray;
53 class PDBSymbolTypeBuiltin;
54 class PDBSymbolTypeTypedef;
55 class PDBSymbolTypeBaseClass;
56 class PDBSymbolTypeFriend;
57 class PDBSymbolTypeFunctionArg;
58 class PDBSymbolFuncDebugStart;
59 class PDBSymbolFuncDebugEnd;
60 class PDBSymbolUsingNamespace;
61 class PDBSymbolTypeVTableShape;
62 class PDBSymbolTypeVTable;
63 class PDBSymbolCustom;
65 class PDBSymbolTypeCustom;
66 class PDBSymbolTypeManaged;
67 class PDBSymbolTypeDimension;
68 class PDBSymbolUnknown;
70 /// Specifies which PDB reader implementation is to be used. Only a value
71 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
72 enum class PDB_ReaderType {
77 /// An enumeration indicating the type of data contained in this table.
78 enum class PDB_TableType {
88 /// Defines flags used for enumerating child symbols. This corresponds to the
89 /// NameSearchOptions enumeration which is documented here:
90 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
91 enum PDB_NameSearchFlags {
93 NS_CaseSensitive = 0x1,
94 NS_CaseInsensitive = 0x2,
95 NS_FileNameExtMatch = 0x4,
97 NS_UndecoratedName = 0x10
100 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
101 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
102 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
103 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
105 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
106 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
107 typedef codeview::CPUType PDB_Cpu;
109 enum class PDB_Machine {
134 /// These values correspond to the CV_call_e enumeration, and are documented
135 /// at the following locations:
136 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
137 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
139 typedef codeview::CallingConvention PDB_CallingConv;
141 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
142 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
143 typedef codeview::SourceLanguage PDB_Lang;
145 /// These values correspond to the DataKind enumeration, and are documented
146 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
147 enum class PDB_DataKind {
160 /// These values correspond to the SymTagEnum enumeration, and are documented
161 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
162 enum class PDB_SymType {
197 /// These values correspond to the LocationType enumeration, and are documented
198 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
199 enum class PDB_LocType {
214 /// These values correspond to the UdtKind enumeration, and are documented
215 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
216 enum class PDB_UdtType { Struct, Class, Union, Interface };
218 /// These values correspond to the StackFrameTypeEnum enumeration, and are
219 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
220 enum class PDB_StackFrameType { FPO, KernelTrap, KernelTSS, EBP, FrameData };
222 /// These values correspond to the StackFrameTypeEnum enumeration, and are
223 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
224 enum class PDB_MemoryType { Code, Data, Stack, HeapCode };
226 /// These values correspond to the Basictype enumeration, and are documented
227 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
228 enum class PDB_BuiltinType {
249 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
258 enum PDB_VariantType {
276 Variant() : Type(PDB_VariantType::Empty) {}
278 Variant(const Variant &Other) : Type(PDB_VariantType::Empty) {
283 if (Type == PDB_VariantType::String)
284 delete[] Value.String;
287 PDB_VariantType Type;
303 #define VARIANT_EQUAL_CASE(Enum) \
304 case PDB_VariantType::Enum: \
305 return Value.Enum == Other.Value.Enum;
307 bool operator==(const Variant &Other) const {
308 if (Type != Other.Type)
311 VARIANT_EQUAL_CASE(Bool)
312 VARIANT_EQUAL_CASE(Int8)
313 VARIANT_EQUAL_CASE(Int16)
314 VARIANT_EQUAL_CASE(Int32)
315 VARIANT_EQUAL_CASE(Int64)
316 VARIANT_EQUAL_CASE(Single)
317 VARIANT_EQUAL_CASE(Double)
318 VARIANT_EQUAL_CASE(UInt8)
319 VARIANT_EQUAL_CASE(UInt16)
320 VARIANT_EQUAL_CASE(UInt32)
321 VARIANT_EQUAL_CASE(UInt64)
322 VARIANT_EQUAL_CASE(String)
328 #undef VARIANT_EQUAL_CASE
330 bool operator!=(const Variant &Other) const { return !(*this == Other); }
331 Variant &operator=(const Variant &Other) {
334 if (Type == PDB_VariantType::String)
335 delete[] Value.String;
338 if (Other.Type == PDB_VariantType::String &&
339 Other.Value.String != nullptr) {
340 Value.String = new char[strlen(Other.Value.String) + 1];
341 ::strcpy(Value.String, Other.Value.String);
347 } // end namespace llvm
351 template <> struct hash<llvm::pdb::PDB_SymType> {
352 typedef llvm::pdb::PDB_SymType argument_type;
353 typedef std::size_t result_type;
355 result_type operator()(const argument_type &Arg) const {
356 return std::hash<int>()(static_cast<int>(Arg));
359 } // end namespace std
361 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H