LLVM  8.0.0svn
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 <cctype>
17 #include <cstddef>
18 #include <cstdint>
19 #include <cstring>
20 #include <functional>
21 
22 namespace llvm {
23 namespace pdb {
24 
26 
27 class IPDBDataStream;
28 class IPDBInjectedSource;
29 class IPDBLineNumber;
30 class IPDBSectionContrib;
31 class IPDBSourceFile;
32 class IPDBTable;
33 class PDBSymDumper;
34 class PDBSymbol;
35 class PDBSymbolExe;
36 class PDBSymbolCompiland;
39 class PDBSymbolFunc;
40 class PDBSymbolBlock;
41 class PDBSymbolData;
43 class PDBSymbolLabel;
45 class PDBSymbolTypeUDT;
46 class PDBSymbolTypeEnum;
49 class PDBSymbolTypeArray;
60 class PDBSymbolCustom;
61 class PDBSymbolThunk;
65 class PDBSymbolUnknown;
66 
74 
75 /// Specifies which PDB reader implementation is to be used. Only a value
76 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
77 enum class PDB_ReaderType {
78  DIA = 0,
79  Native = 1,
80 };
81 
82 /// An enumeration indicating the type of data contained in this table.
83 enum class PDB_TableType {
84  TableInvalid = 0,
85  Symbols,
89  Segments,
91  FrameData,
93  Dbg
94 };
95 
96 /// Defines flags used for enumerating child symbols. This corresponds to the
97 /// NameSearchOptions enumeration which is documented here:
98 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
100  NS_Default = 0x0,
104  NS_Regex = 0x8,
106 
107  // For backward compatibility.
111 };
112 
113 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
114 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
115 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
116 enum class PDB_Checksum { None = 0, MD5 = 1, SHA1 = 2, SHA256 = 3 };
117 
118 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
119 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
121 
122 enum class PDB_Machine {
123  Invalid = 0xffff,
124  Unknown = 0x0,
125  Am33 = 0x13,
126  Amd64 = 0x8664,
127  Arm = 0x1C0,
128  ArmNT = 0x1C4,
129  Ebc = 0xEBC,
130  x86 = 0x14C,
131  Ia64 = 0x200,
132  M32R = 0x9041,
133  Mips16 = 0x266,
134  MipsFpu = 0x366,
135  MipsFpu16 = 0x466,
136  PowerPC = 0x1F0,
137  PowerPCFP = 0x1F1,
138  R4000 = 0x166,
139  SH3 = 0x1A2,
140  SH3DSP = 0x1A3,
141  SH4 = 0x1A6,
142  SH5 = 0x1A8,
143  Thumb = 0x1C2,
144  WceMipsV2 = 0x169
145 };
146 
148  None,
150  Huffman,
151  LZ,
152 };
153 
154 /// These values correspond to the CV_call_e enumeration, and are documented
155 /// at the following locations:
156 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
157 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
159 
160 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
161 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
163 
164 /// These values correspond to the DataKind enumeration, and are documented
165 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
166 enum class PDB_DataKind {
167  Unknown,
168  Local,
169  StaticLocal,
170  Param,
171  ObjectPtr,
172  FileStatic,
173  Global,
174  Member,
175  StaticMember,
176  Constant
177 };
178 
179 /// These values correspond to the SymTagEnum enumeration, and are documented
180 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
181 enum class PDB_SymType {
182  None,
183  Exe,
184  Compiland,
186  CompilandEnv,
187  Function,
188  Block,
189  Data,
190  Annotation,
191  Label,
192  PublicSymbol,
193  UDT,
194  Enum,
195  FunctionSig,
196  PointerType,
197  ArrayType,
198  BuiltinType,
199  Typedef,
200  BaseClass,
201  Friend,
202  FunctionArg,
204  FuncDebugEnd,
206  VTableShape,
207  VTable,
208  Custom,
209  Thunk,
210  CustomType,
211  ManagedType,
212  Dimension,
213  Max
214 };
215 
216 /// These values correspond to the LocationType enumeration, and are documented
217 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
218 enum class PDB_LocType {
219  Null,
220  Static,
221  TLS,
222  RegRel,
223  ThisRel,
224  Enregistered,
225  BitField,
226  Slot,
227  IlRel,
228  MetaData,
229  Constant,
231  Max
232 };
233 
234 /// These values correspond to the UdtKind enumeration, and are documented
235 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
237 
238 /// These values correspond to the StackFrameTypeEnum enumeration, and are
239 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
240 enum class PDB_StackFrameType : uint16_t {
241  FPO,
242  KernelTrap,
243  KernelTSS,
244  EBP,
245  FrameData,
246  Unknown = 0xffff
247 };
248 
249 /// These values correspond to the MemoryTypeEnum enumeration, and are
250 /// documented here: https://msdn.microsoft.com/en-us/library/ms165609.aspx.
251 enum class PDB_MemoryType : uint16_t {
252  Code,
253  Data,
254  Stack,
255  HeapCode,
256  Any = 0xffff
257 };
258 
259 /// These values correspond to the Basictype enumeration, and are documented
260 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
261 enum class PDB_BuiltinType {
262  None = 0,
263  Void = 1,
264  Char = 2,
265  WCharT = 3,
266  Int = 6,
267  UInt = 7,
268  Float = 8,
269  BCD = 9,
270  Bool = 10,
271  Long = 13,
272  ULong = 14,
273  Currency = 25,
274  Date = 26,
275  Variant = 27,
276  Complex = 28,
277  Bitfield = 29,
278  BSTR = 30,
279  HResult = 31,
280  Char16 = 32,
281  Char32 = 33
282 };
283 
284 /// These values correspond to the flags that can be combined to control the
285 /// return of an undecorated name for a C++ decorated name, and are documented
286 /// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx
305  Undname_NoECSU = 0x8000,
307  Undname_NoPTR64 = 0x20000
308 };
309 
310 enum class PDB_MemberAccess { Private = 1, Protected = 2, Public = 3 };
311 
312 struct VersionInfo {
317 };
318 
334 };
335 
336 struct Variant {
337  Variant() = default;
338 
339  explicit Variant(bool V) : Type(PDB_VariantType::Bool) { Value.Bool = V; }
340  explicit Variant(int8_t V) : Type(PDB_VariantType::Int8) { Value.Int8 = V; }
341  explicit Variant(int16_t V) : Type(PDB_VariantType::Int16) {
342  Value.Int16 = V;
343  }
344  explicit Variant(int32_t V) : Type(PDB_VariantType::Int32) {
345  Value.Int32 = V;
346  }
347  explicit Variant(int64_t V) : Type(PDB_VariantType::Int64) {
348  Value.Int64 = V;
349  }
350  explicit Variant(float V) : Type(PDB_VariantType::Single) {
351  Value.Single = V;
352  }
353  explicit Variant(double V) : Type(PDB_VariantType::Double) {
354  Value.Double = V;
355  }
356  explicit Variant(uint8_t V) : Type(PDB_VariantType::UInt8) {
357  Value.UInt8 = V;
358  }
359  explicit Variant(uint16_t V) : Type(PDB_VariantType::UInt16) {
360  Value.UInt16 = V;
361  }
363  Value.UInt32 = V;
364  }
365  explicit Variant(uint64_t V) : Type(PDB_VariantType::UInt64) {
366  Value.UInt64 = V;
367  }
368 
369  Variant(const Variant &Other) {
370  *this = Other;
371  }
372 
375  delete[] Value.String;
376  }
377 
379  union {
380  bool Bool;
381  int8_t Int8;
382  int16_t Int16;
383  int32_t Int32;
384  int64_t Int64;
385  float Single;
386  double Double;
387  uint8_t UInt8;
388  uint16_t UInt16;
390  uint64_t UInt64;
391  char *String;
392  } Value;
393 
394 #define VARIANT_EQUAL_CASE(Enum) \
395  case PDB_VariantType::Enum: \
396  return Value.Enum == Other.Value.Enum;
397 
398  bool operator==(const Variant &Other) const {
399  if (Type != Other.Type)
400  return false;
401  switch (Type) {
414  default:
415  return true;
416  }
417  }
418 
419 #undef VARIANT_EQUAL_CASE
420 
421  bool operator!=(const Variant &Other) const { return !(*this == Other); }
422  Variant &operator=(const Variant &Other) {
423  if (this == &Other)
424  return *this;
425  if (Type == PDB_VariantType::String)
426  delete[] Value.String;
427  Type = Other.Type;
428  Value = Other.Value;
429  if (Other.Type == PDB_VariantType::String &&
430  Other.Value.String != nullptr) {
431  Value.String = new char[strlen(Other.Value.String) + 1];
432  ::strcpy(Value.String, Other.Value.String);
433  }
434  return *this;
435  }
436 };
437 
438 } // end namespace pdb
439 } // end namespace llvm
440 
441 namespace std {
442 
443 template <> struct hash<llvm::pdb::PDB_SymType> {
445  using result_type = std::size_t;
446 
448  return std::hash<int>()(static_cast<int>(Arg));
449  }
450 };
451 
452 } // end namespace std
453 
454 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H
Variant(double V)
Definition: PDBTypes.h:353
Definition: Any.h:27
Variant(uint16_t V)
Definition: PDBTypes.h:359
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
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:236
PDBSymbolCustom represents symbols that are compiler-specific and do not fit anywhere else in the lex...
result_type operator()(const argument_type &Arg) const
Definition: PDBTypes.h:447
Variant(int8_t V)
Definition: PDBTypes.h:340
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:99
PDB_ReaderType
Specifies which PDB reader implementation is to be used.
Definition: PDBTypes.h:77
A class that wrap the SHA1 algorithm.
Definition: SHA1.h:29
bool operator!=(const Variant &Other) const
Definition: PDBTypes.h:421
PDB_Checksum
Specifies the hash algorithm that a source file from a PDB was hashed with.
Definition: PDBTypes.h:116
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
Variant(uint64_t V)
Definition: PDBTypes.h:365
Definition: BitVector.h:938
union llvm::pdb::Variant::@200 Value
IPDBInjectedSource defines an interface used to represent source files which were injected directly i...
IPDBSectionContrib defines an interface used to represent section contributions whose information are...
PDB_UndnameFlags
These values correspond to the flags that can be combined to control the return of an undecorated nam...
Definition: PDBTypes.h:287
Variant(uint8_t V)
Definition: PDBTypes.h:356
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:181
uint32_t UInt32
Definition: PDBTypes.h:389
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
Variant(int32_t V)
Definition: PDBTypes.h:344
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:166
#define VARIANT_EQUAL_CASE(Enum)
Definition: PDBTypes.h:394
Variant(uint32_t V)
Definition: PDBTypes.h:362
PDB_SourceCompression
Definition: PDBTypes.h:147
PDB_LocType
These values correspond to the LocationType enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:218
uint64_t UInt64
Definition: PDBTypes.h:390
IPDBDataStream defines an interface used to represent a stream consisting of a name and a series of r...
Variant(int64_t V)
Definition: PDBTypes.h:347
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:144
Variant(const Variant &Other)
Definition: PDBTypes.h:369
CPUType
These values correspond to the CV_CPU_TYPE_e enumeration, and are documented here: https://msdn...
Definition: CodeView.h:79
PDBSymbol defines the base of the inheritance hierarchy for concrete symbol types (e...
Definition: PDBSymbol.h:74
PDB_TableType
An enumeration indicating the type of data contained in this table.
Definition: PDBTypes.h:83
PDB_MemoryType
These values correspond to the MemoryTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:251
PDB_VariantType
Definition: PDBTypes.h:319
amdgpu Simplify well known AMD library false Value Value * Arg
uint32_t SymIndexId
Definition: PDBTypes.h:25
uint16_t UInt16
Definition: PDBTypes.h:388
Definition: MD5.h:41
PDB_StackFrameType
These values correspond to the StackFrameTypeEnum enumeration, and are documented here: https://msdn...
Definition: PDBTypes.h:240
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:261
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:173
Variant & operator=(const Variant &Other)
Definition: PDBTypes.h:422
bool operator==(const Variant &Other) const
Definition: PDBTypes.h:398
Variant(int16_t V)
Definition: PDBTypes.h:341
PDB_VariantType Type
Definition: PDBTypes.h:378
Variant(float V)
Definition: PDBTypes.h:350
PDB_MemberAccess
Definition: PDBTypes.h:310