LLVM  5.0.0
PDBTypes.h
Go to the documentation of this file.
1 //===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
11 #define LLVM_DEBUGINFO_PDB_PDBTYPES_H
12 
16 #include <cstddef>
17 #include <cstdint>
18 #include <cstring>
19 #include <functional>
20 
21 namespace llvm {
22 namespace pdb {
23 
24 class IPDBDataStream;
25 class IPDBLineNumber;
26 class IPDBSourceFile;
27 class PDBSymDumper;
28 class PDBSymbol;
29 class PDBSymbolExe;
30 class PDBSymbolCompiland;
31 class PDBSymbolCompilandDetails;
32 class PDBSymbolCompilandEnv;
33 class PDBSymbolFunc;
34 class PDBSymbolBlock;
35 class PDBSymbolData;
36 class PDBSymbolAnnotation;
37 class PDBSymbolLabel;
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;
55 class PDBSymbolThunk;
56 class PDBSymbolTypeCustom;
57 class PDBSymbolTypeManaged;
58 class PDBSymbolTypeDimension;
59 class PDBSymbolUnknown;
60 
65 
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 {
69  DIA = 0,
70  Native = 1,
71 };
72 
73 /// An enumeration indicating the type of data contained in this table.
74 enum class PDB_TableType {
75  Symbols,
79  Segments,
81  FrameData
82 };
83 
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
88  NS_Default = 0x0,
92  NS_Regex = 0x8,
94 };
95 
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 };
100 
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
104 
105 enum class PDB_Machine {
106  Invalid = 0xffff,
107  Unknown = 0x0,
108  Am33 = 0x13,
109  Amd64 = 0x8664,
110  Arm = 0x1C0,
111  ArmNT = 0x1C4,
112  Ebc = 0xEBC,
113  x86 = 0x14C,
114  Ia64 = 0x200,
115  M32R = 0x9041,
116  Mips16 = 0x266,
117  MipsFpu = 0x366,
118  MipsFpu16 = 0x466,
119  PowerPC = 0x1F0,
120  PowerPCFP = 0x1F1,
121  R4000 = 0x166,
122  SH3 = 0x1A2,
123  SH3DSP = 0x1A3,
124  SH4 = 0x1A6,
125  SH5 = 0x1A8,
126  Thumb = 0x1C2,
127  WceMipsV2 = 0x169
128 };
129 
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
135 
136 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
137 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
139 
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 {
143  Unknown,
144  Local,
145  StaticLocal,
146  Param,
147  ObjectPtr,
148  FileStatic,
149  Global,
150  Member,
151  StaticMember,
152  Constant
153 };
154 
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 {
158  None,
159  Exe,
160  Compiland,
162  CompilandEnv,
163  Function,
164  Block,
165  Data,
166  Annotation,
167  Label,
168  PublicSymbol,
169  UDT,
170  Enum,
171  FunctionSig,
172  PointerType,
173  ArrayType,
174  BuiltinType,
175  Typedef,
176  BaseClass,
177  Friend,
178  FunctionArg,
180  FuncDebugEnd,
182  VTableShape,
183  VTable,
184  Custom,
185  Thunk,
186  CustomType,
187  ManagedType,
188  Dimension,
189  Max
190 };
191 
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 {
195  Null,
196  Static,
197  TLS,
198  RegRel,
199  ThisRel,
200  Enregistered,
201  BitField,
202  Slot,
203  IlRel,
204  MetaData,
205  Constant,
206  Max
207 };
208 
209 /// These values correspond to the UdtKind enumeration, and are documented
210 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
212 
213 /// These values correspond to the StackFrameTypeEnum enumeration, and are
214 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
216 
217 /// These values correspond to the StackFrameTypeEnum enumeration, and are
218 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
220 
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 {
224  None = 0,
225  Void = 1,
226  Char = 2,
227  WCharT = 3,
228  Int = 6,
229  UInt = 7,
230  Float = 8,
231  BCD = 9,
232  Bool = 10,
233  Long = 13,
234  ULong = 14,
235  Currency = 25,
236  Date = 26,
237  Variant = 27,
238  Complex = 28,
239  Bitfield = 29,
240  BSTR = 30,
241  HResult = 31
242 };
243 
244 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
245 
246 struct VersionInfo {
251 };
252 
268 };
269 
270 struct Variant {
271  Variant() = default;
272 
273  Variant(const Variant &Other) {
274  *this = Other;
275  }
276 
279  delete[] Value.String;
280  }
281 
283  union {
284  bool Bool;
285  int8_t Int8;
286  int16_t Int16;
287  int32_t Int32;
288  int64_t Int64;
289  float Single;
290  double Double;
291  uint8_t UInt8;
292  uint16_t UInt16;
294  uint64_t UInt64;
295  char *String;
296  } Value;
297 
298 #define VARIANT_EQUAL_CASE(Enum) \
299  case PDB_VariantType::Enum: \
300  return Value.Enum == Other.Value.Enum;
301 
302  bool operator==(const Variant &Other) const {
303  if (Type != Other.Type)
304  return false;
305  switch (Type) {
318  default:
319  return true;
320  }
321  }
322 
323 #undef VARIANT_EQUAL_CASE
324 
325  bool operator!=(const Variant &Other) const { return !(*this == Other); }
326  Variant &operator=(const Variant &Other) {
327  if (this == &Other)
328  return *this;
330  delete[] Value.String;
331  Type = Other.Type;
332  Value = Other.Value;
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);
337  }
338  return *this;
339  }
340 };
341 
342 } // end namespace pdb
343 } // end namespace llvm
344 
345 namespace std {
346 
347 template <> struct hash<llvm::pdb::PDB_SymType> {
349  using result_type = std::size_t;
350 
352  return std::hash<int>()(static_cast<int>(Arg));
353  }
354 };
355 
356 } // end namespace std
357 
358 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
PDB_UdtType
These values correspond to the UdtKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx.
Definition: PDBTypes.h:211
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:87
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition: PDBTypes.h:68
A class that wrap the SHA1 algorithm.
Definition: SHA1.h:29
PDB_Checksum
Specifies the hash algorithm that a source file from a PDB was hashed with.
Definition: PDBTypes.h:99
PDB_MemoryType
These values correspond to the StackFrameTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:219
bool operator!=(const Variant &Other) const
Definition: PDBTypes.h:325
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
Definition: PDBTypes.h:157
uint32_t UInt32
Definition: PDBTypes.h:293
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
This is an important base class in LLVM.
Definition: Constant.h:42
PDB_DataKind
These values correspond to the DataKind enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx.
Definition: PDBTypes.h:142
#define VARIANT_EQUAL_CASE(Enum)
Definition: PDBTypes.h:298
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:194
uint64_t UInt64
Definition: PDBTypes.h:294
SourceLanguage
These values correspond to the CV_CFL_LANG enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx.
Definition: CodeView.h:143
Variant(const Variant &Other)
Definition: PDBTypes.h:273
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: CodeView.h:79
PDB_TableType
An enumeration indicating the type of data contained in this table.
Definition: PDBTypes.h:74
PDB_VariantType
Definition: PDBTypes.h:253
PDB_StackFrameType
These values correspond to the StackFrameTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:215
bool operator==(const Variant &Other) const
Definition: PDBTypes.h:302
union llvm::pdb::Variant::@173 Value
uint16_t UInt16
Definition: PDBTypes.h:292
Definition: MD5.h:41
PDB_BuiltinType
These values correspond to the Basictype enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx.
Definition: PDBTypes.h:223
LLVM Value Representation.
Definition: Value.h:73
CallingConvention
These values correspond to the CV_call_e enumeration, and are documented at the following locations: ...
Definition: CodeView.h:168
Variant & operator=(const Variant &Other)
Definition: PDBTypes.h:326
PDB_VariantType Type
Definition: PDBTypes.h:282
result_type operator()(const argument_type &Arg) const
Definition: PDBTypes.h:351
PDB_MemberAccess
Definition: PDBTypes.h:244