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"
26 template <class T> class IPDBEnumChildren;
32 typedef IPDBEnumChildren<PDBSymbol> IPDBEnumSymbols;
33 typedef IPDBEnumChildren<IPDBSourceFile> IPDBEnumSourceFiles;
34 typedef IPDBEnumChildren<IPDBDataStream> IPDBEnumDataStreams;
35 typedef IPDBEnumChildren<IPDBLineNumber> IPDBEnumLineNumbers;
38 class PDBSymbolCompiland;
39 class PDBSymbolCompilandDetails;
40 class PDBSymbolCompilandEnv;
44 class PDBSymbolAnnotation;
46 class PDBSymbolPublicSymbol;
47 class PDBSymbolTypeUDT;
48 class PDBSymbolTypeEnum;
49 class PDBSymbolTypeFunctionSig;
50 class PDBSymbolTypePointer;
51 class PDBSymbolTypeArray;
52 class PDBSymbolTypeBuiltin;
53 class PDBSymbolTypeTypedef;
54 class PDBSymbolTypeBaseClass;
55 class PDBSymbolTypeFriend;
56 class PDBSymbolTypeFunctionArg;
57 class PDBSymbolFuncDebugStart;
58 class PDBSymbolFuncDebugEnd;
59 class PDBSymbolUsingNamespace;
60 class PDBSymbolTypeVTableShape;
61 class PDBSymbolTypeVTable;
62 class PDBSymbolCustom;
64 class PDBSymbolTypeCustom;
65 class PDBSymbolTypeManaged;
66 class PDBSymbolTypeDimension;
67 class PDBSymbolUnknown;
69 /// Specifies which PDB reader implementation is to be used. Only a value
70 /// of PDB_ReaderType::DIA is supported.
71 enum class PDB_ReaderType {
76 /// Defines a 128-bit unique identifier. This maps to a GUID on Windows, but
77 /// is abstracted here for the purposes of non-Windows platforms that don't have
78 /// the GUID structure defined.
83 /// An enumeration indicating the type of data contained in this table.
84 enum class PDB_TableType {
94 /// Defines flags used for enumerating child symbols. This corresponds to the
95 /// NameSearchOptions enumeration which is documented here:
96 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
97 enum PDB_NameSearchFlags {
99 NS_CaseSensitive = 0x1,
100 NS_CaseInsensitive = 0x2,
101 NS_FileNameExtMatch = 0x4,
103 NS_UndecoratedName = 0x10
106 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
107 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
108 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
109 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
111 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
112 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
113 typedef codeview::CPUType PDB_Cpu;
115 enum class PDB_Machine {
140 /// These values correspond to the CV_call_e enumeration, and are documented
141 /// at the following locations:
142 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
143 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
145 typedef codeview::CallingConvention PDB_CallingConv;
147 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
148 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
149 typedef codeview::SourceLanguage PDB_Lang;
151 /// These values correspond to the DataKind enumeration, and are documented
152 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
153 enum class PDB_DataKind {
166 /// These values correspond to the SymTagEnum enumeration, and are documented
167 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
168 enum class PDB_SymType {
203 /// These values correspond to the LocationType enumeration, and are documented
204 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
205 enum class PDB_LocType {
220 /// These values correspond to the UdtKind enumeration, and are documented
221 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
222 enum class PDB_UdtType { Struct, Class, Union, Interface };
224 /// These values correspond to the StackFrameTypeEnum enumeration, and are
225 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
226 enum class PDB_StackFrameType { FPO, KernelTrap, KernelTSS, EBP, FrameData };
228 /// These values correspond to the StackFrameTypeEnum enumeration, and are
229 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
230 enum class PDB_MemoryType { Code, Data, Stack, HeapCode };
232 /// These values correspond to the Basictype enumeration, and are documented
233 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
234 enum class PDB_BuiltinType {
255 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
264 enum PDB_VariantType {
282 Variant() : Type(PDB_VariantType::Empty) {}
284 Variant(const Variant &Other) : Type(PDB_VariantType::Empty) {
289 if (Type == PDB_VariantType::String)
290 delete[] Value.String;
293 PDB_VariantType Type;
309 #define VARIANT_EQUAL_CASE(Enum) \
310 case PDB_VariantType::Enum: \
311 return Value.Enum == Other.Value.Enum;
313 bool operator==(const Variant &Other) const {
314 if (Type != Other.Type)
317 VARIANT_EQUAL_CASE(Bool)
318 VARIANT_EQUAL_CASE(Int8)
319 VARIANT_EQUAL_CASE(Int16)
320 VARIANT_EQUAL_CASE(Int32)
321 VARIANT_EQUAL_CASE(Int64)
322 VARIANT_EQUAL_CASE(Single)
323 VARIANT_EQUAL_CASE(Double)
324 VARIANT_EQUAL_CASE(UInt8)
325 VARIANT_EQUAL_CASE(UInt16)
326 VARIANT_EQUAL_CASE(UInt32)
327 VARIANT_EQUAL_CASE(UInt64)
328 VARIANT_EQUAL_CASE(String)
334 #undef VARIANT_EQUAL_CASE
336 bool operator!=(const Variant &Other) const { return !(*this == Other); }
337 Variant &operator=(const Variant &Other) {
340 if (Type == PDB_VariantType::String)
341 delete[] Value.String;
344 if (Other.Type == PDB_VariantType::String &&
345 Other.Value.String != nullptr) {
346 Value.String = new char[strlen(Other.Value.String) + 1];
347 ::strcpy(Value.String, Other.Value.String);
353 } // end namespace llvm
357 template <> struct hash<llvm::pdb::PDB_SymType> {
358 typedef llvm::pdb::PDB_SymType argument_type;
359 typedef std::size_t result_type;
361 result_type operator()(const argument_type &Arg) const {
362 return std::hash<int>()(static_cast<int>(Arg));
365 } // end namespace std
367 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H