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"
30 class PDBSymbolCompiland;
31 class PDBSymbolCompilandDetails;
32 class PDBSymbolCompilandEnv;
36 class PDBSymbolAnnotation;
38 class PDBSymbolPublicSymbol;
39 class PDBSymbolTypeUDT;
40 class PDBSymbolTypeEnum;
41 class PDBSymbolTypeFunctionSig;
42 class PDBSymbolTypePointer;
43 class PDBSymbolTypeArray;
44 class PDBSymbolTypeBuiltin;
45 class PDBSymbolTypeTypedef;
46 class PDBSymbolTypeBaseClass;
47 class PDBSymbolTypeFriend;
48 class PDBSymbolTypeFunctionArg;
49 class PDBSymbolFuncDebugStart;
50 class PDBSymbolFuncDebugEnd;
51 class PDBSymbolUsingNamespace;
52 class PDBSymbolTypeVTableShape;
53 class PDBSymbolTypeVTable;
54 class PDBSymbolCustom;
56 class PDBSymbolTypeCustom;
57 class PDBSymbolTypeManaged;
58 class PDBSymbolTypeDimension;
59 class PDBSymbolUnknown;
61 using IPDBEnumSymbols = IPDBEnumChildren<PDBSymbol>;
62 using IPDBEnumSourceFiles = IPDBEnumChildren<IPDBSourceFile>;
63 using IPDBEnumDataStreams = IPDBEnumChildren<IPDBDataStream>;
64 using IPDBEnumLineNumbers = IPDBEnumChildren<IPDBLineNumber>;
66 /// Specifies which PDB reader implementation is to be used. Only a value
67 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
68 enum class PDB_ReaderType {
73 /// An enumeration indicating the type of data contained in this table.
74 enum class PDB_TableType {
84 /// Defines flags used for enumerating child symbols. This corresponds to the
85 /// NameSearchOptions enumeration which is documented here:
86 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
87 enum PDB_NameSearchFlags {
89 NS_CaseSensitive = 0x1,
90 NS_CaseInsensitive = 0x2,
91 NS_FileNameExtMatch = 0x4,
93 NS_UndecoratedName = 0x10
96 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
97 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
98 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
99 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2 };
101 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
102 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
103 using PDB_Cpu = codeview::CPUType;
105 enum class PDB_Machine {
130 /// These values correspond to the CV_call_e enumeration, and are documented
131 /// at the following locations:
132 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
133 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
134 using PDB_CallingConv = codeview::CallingConvention;
136 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
137 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
138 using PDB_Lang = codeview::SourceLanguage;
140 /// These values correspond to the DataKind enumeration, and are documented
141 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
142 enum class PDB_DataKind {
155 /// These values correspond to the SymTagEnum enumeration, and are documented
156 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
157 enum class PDB_SymType {
192 /// These values correspond to the LocationType enumeration, and are documented
193 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
194 enum class PDB_LocType {
209 /// These values correspond to the UdtKind enumeration, and are documented
210 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
211 enum class PDB_UdtType { Struct, Class, Union, Interface };
213 /// These values correspond to the StackFrameTypeEnum enumeration, and are
214 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
215 enum class PDB_StackFrameType { FPO, KernelTrap, KernelTSS, EBP, FrameData };
217 /// These values correspond to the StackFrameTypeEnum enumeration, and are
218 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
219 enum class PDB_MemoryType { Code, Data, Stack, HeapCode };
221 /// These values correspond to the Basictype enumeration, and are documented
222 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
223 enum class PDB_BuiltinType {
244 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
253 enum PDB_VariantType {
273 Variant(const Variant &Other) {
278 if (Type == PDB_VariantType::String)
279 delete[] Value.String;
282 PDB_VariantType Type = PDB_VariantType::Empty;
298 #define VARIANT_EQUAL_CASE(Enum) \
299 case PDB_VariantType::Enum: \
300 return Value.Enum == Other.Value.Enum;
302 bool operator==(const Variant &Other) const {
303 if (Type != Other.Type)
306 VARIANT_EQUAL_CASE(Bool)
307 VARIANT_EQUAL_CASE(Int8)
308 VARIANT_EQUAL_CASE(Int16)
309 VARIANT_EQUAL_CASE(Int32)
310 VARIANT_EQUAL_CASE(Int64)
311 VARIANT_EQUAL_CASE(Single)
312 VARIANT_EQUAL_CASE(Double)
313 VARIANT_EQUAL_CASE(UInt8)
314 VARIANT_EQUAL_CASE(UInt16)
315 VARIANT_EQUAL_CASE(UInt32)
316 VARIANT_EQUAL_CASE(UInt64)
317 VARIANT_EQUAL_CASE(String)
323 #undef VARIANT_EQUAL_CASE
325 bool operator!=(const Variant &Other) const { return !(*this == Other); }
326 Variant &operator=(const Variant &Other) {
329 if (Type == PDB_VariantType::String)
330 delete[] Value.String;
333 if (Other.Type == PDB_VariantType::String &&
334 Other.Value.String != nullptr) {
335 Value.String = new char[strlen(Other.Value.String) + 1];
336 ::strcpy(Value.String, Other.Value.String);
342 } // end namespace pdb
343 } // end namespace llvm
347 template <> struct hash<llvm::pdb::PDB_SymType> {
348 using argument_type = llvm::pdb::PDB_SymType;
349 using result_type = std::size_t;
351 result_type operator()(const argument_type &Arg) const {
352 return std::hash<int>()(static_cast<int>(Arg));
356 } // end namespace std
358 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H