1 //===- PDBTypes.h - Defines enums for various fields contained in PDB ----====//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_DEBUGINFO_PDB_PDBTYPES_H
10 #define LLVM_DEBUGINFO_PDB_PDBTYPES_H
12 #include "llvm/DebugInfo/CodeView/CodeView.h"
13 #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
14 #include "llvm/DebugInfo/PDB/IPDBFrameData.h"
15 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
25 typedef uint32_t SymIndexId
;
28 class IPDBInjectedSource
;
30 class IPDBSectionContrib
;
36 class PDBSymbolCompiland
;
37 class PDBSymbolCompilandDetails
;
38 class PDBSymbolCompilandEnv
;
42 class PDBSymbolAnnotation
;
44 class PDBSymbolPublicSymbol
;
45 class PDBSymbolTypeUDT
;
46 class PDBSymbolTypeEnum
;
47 class PDBSymbolTypeFunctionSig
;
48 class PDBSymbolTypePointer
;
49 class PDBSymbolTypeArray
;
50 class PDBSymbolTypeBuiltin
;
51 class PDBSymbolTypeTypedef
;
52 class PDBSymbolTypeBaseClass
;
53 class PDBSymbolTypeFriend
;
54 class PDBSymbolTypeFunctionArg
;
55 class PDBSymbolFuncDebugStart
;
56 class PDBSymbolFuncDebugEnd
;
57 class PDBSymbolUsingNamespace
;
58 class PDBSymbolTypeVTableShape
;
59 class PDBSymbolTypeVTable
;
60 class PDBSymbolCustom
;
62 class PDBSymbolTypeCustom
;
63 class PDBSymbolTypeManaged
;
64 class PDBSymbolTypeDimension
;
65 class PDBSymbolUnknown
;
67 using IPDBEnumSymbols
= IPDBEnumChildren
<PDBSymbol
>;
68 using IPDBEnumSourceFiles
= IPDBEnumChildren
<IPDBSourceFile
>;
69 using IPDBEnumDataStreams
= IPDBEnumChildren
<IPDBDataStream
>;
70 using IPDBEnumLineNumbers
= IPDBEnumChildren
<IPDBLineNumber
>;
71 using IPDBEnumTables
= IPDBEnumChildren
<IPDBTable
>;
72 using IPDBEnumInjectedSources
= IPDBEnumChildren
<IPDBInjectedSource
>;
73 using IPDBEnumSectionContribs
= IPDBEnumChildren
<IPDBSectionContrib
>;
74 using IPDBEnumFrameData
= IPDBEnumChildren
<IPDBFrameData
>;
76 /// Specifies which PDB reader implementation is to be used. Only a value
77 /// of PDB_ReaderType::DIA is currently supported, but Native is in the works.
78 enum class PDB_ReaderType
{
83 /// An enumeration indicating the type of data contained in this table.
84 enum class PDB_TableType
{
97 /// Defines flags used for enumerating child symbols. This corresponds to the
98 /// NameSearchOptions enumeration which is documented here:
99 /// https://msdn.microsoft.com/en-us/library/yat28ads.aspx
100 enum PDB_NameSearchFlags
{
102 NS_CaseSensitive
= 0x1,
103 NS_CaseInsensitive
= 0x2,
104 NS_FileNameExtMatch
= 0x4,
106 NS_UndecoratedName
= 0x10,
108 // For backward compatibility.
109 NS_CaseInFileNameExt
= NS_CaseInsensitive
| NS_FileNameExtMatch
,
110 NS_CaseRegex
= NS_Regex
| NS_CaseSensitive
,
111 NS_CaseInRex
= NS_Regex
| NS_CaseInsensitive
114 /// Specifies the hash algorithm that a source file from a PDB was hashed with.
115 /// This corresponds to the CV_SourceChksum_t enumeration and are documented
116 /// here: https://msdn.microsoft.com/en-us/library/e96az21x.aspx
117 enum class PDB_Checksum
{ None
= 0, MD5
= 1, SHA1
= 2, SHA256
= 3 };
119 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
120 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
121 using PDB_Cpu
= codeview::CPUType
;
123 enum class PDB_Machine
{
148 enum class PDB_SourceCompression
{
155 /// These values correspond to the CV_call_e enumeration, and are documented
156 /// at the following locations:
157 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
158 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
159 using PDB_CallingConv
= codeview::CallingConvention
;
161 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
162 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
163 using PDB_Lang
= codeview::SourceLanguage
;
165 /// These values correspond to the DataKind enumeration, and are documented
166 /// here: https://msdn.microsoft.com/en-us/library/b2x2t313.aspx
167 enum class PDB_DataKind
{
180 /// These values correspond to the SymTagEnum enumeration, and are documented
181 /// here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx
182 enum class PDB_SymType
{
229 /// These values correspond to the LocationType enumeration, and are documented
230 /// here: https://msdn.microsoft.com/en-us/library/f57kaez3.aspx
231 enum class PDB_LocType
{
247 /// These values correspond to the UdtKind enumeration, and are documented
248 /// here: https://msdn.microsoft.com/en-us/library/wcstk66t.aspx
249 enum class PDB_UdtType
{ Struct
, Class
, Union
, Interface
};
251 /// These values correspond to the StackFrameTypeEnum enumeration, and are
252 /// documented here: https://msdn.microsoft.com/en-us/library/bc5207xw.aspx.
253 enum class PDB_StackFrameType
: uint16_t {
262 /// These values correspond to the MemoryTypeEnum enumeration, and are
263 /// documented here: https://msdn.microsoft.com/en-us/library/ms165609.aspx.
264 enum class PDB_MemoryType
: uint16_t {
272 /// These values correspond to the Basictype enumeration, and are documented
273 /// here: https://msdn.microsoft.com/en-us/library/4szdtzc3.aspx
274 enum class PDB_BuiltinType
{
297 /// These values correspond to the flags that can be combined to control the
298 /// return of an undecorated name for a C++ decorated name, and are documented
299 /// here: https://msdn.microsoft.com/en-us/library/kszfk0fs.aspx
300 enum PDB_UndnameFlags
: uint32_t {
301 Undname_Complete
= 0x0,
302 Undname_NoLeadingUnderscores
= 0x1,
303 Undname_NoMsKeywords
= 0x2,
304 Undname_NoFuncReturns
= 0x4,
305 Undname_NoAllocModel
= 0x8,
306 Undname_NoAllocLang
= 0x10,
307 Undname_Reserved1
= 0x20,
308 Undname_Reserved2
= 0x40,
309 Undname_NoThisType
= 0x60,
310 Undname_NoAccessSpec
= 0x80,
311 Undname_NoThrowSig
= 0x100,
312 Undname_NoMemberType
= 0x200,
313 Undname_NoReturnUDTModel
= 0x400,
314 Undname_32BitDecode
= 0x800,
315 Undname_NameOnly
= 0x1000,
316 Undname_TypeOnly
= 0x2000,
317 Undname_HaveParams
= 0x4000,
318 Undname_NoECSU
= 0x8000,
319 Undname_NoIdentCharCheck
= 0x10000,
320 Undname_NoPTR64
= 0x20000
323 enum class PDB_MemberAccess
{ Private
= 1, Protected
= 2, Public
= 3 };
332 enum PDB_VariantType
{
352 explicit Variant(bool V
) : Type(PDB_VariantType::Bool
) { Value
.Bool
= V
; }
353 explicit Variant(int8_t V
) : Type(PDB_VariantType::Int8
) { Value
.Int8
= V
; }
354 explicit Variant(int16_t V
) : Type(PDB_VariantType::Int16
) {
357 explicit Variant(int32_t V
) : Type(PDB_VariantType::Int32
) {
360 explicit Variant(int64_t V
) : Type(PDB_VariantType::Int64
) {
363 explicit Variant(float V
) : Type(PDB_VariantType::Single
) {
366 explicit Variant(double V
) : Type(PDB_VariantType::Double
) {
369 explicit Variant(uint8_t V
) : Type(PDB_VariantType::UInt8
) {
372 explicit Variant(uint16_t V
) : Type(PDB_VariantType::UInt16
) {
375 explicit Variant(uint32_t V
) : Type(PDB_VariantType::UInt32
) {
378 explicit Variant(uint64_t V
) : Type(PDB_VariantType::UInt64
) {
382 Variant(const Variant
&Other
) {
387 if (Type
== PDB_VariantType::String
)
388 delete[] Value
.String
;
391 PDB_VariantType Type
= PDB_VariantType::Empty
;
407 #define VARIANT_EQUAL_CASE(Enum) \
408 case PDB_VariantType::Enum: \
409 return Value.Enum == Other.Value.Enum;
411 bool operator==(const Variant
&Other
) const {
412 if (Type
!= Other
.Type
)
415 VARIANT_EQUAL_CASE(Bool
)
416 VARIANT_EQUAL_CASE(Int8
)
417 VARIANT_EQUAL_CASE(Int16
)
418 VARIANT_EQUAL_CASE(Int32
)
419 VARIANT_EQUAL_CASE(Int64
)
420 VARIANT_EQUAL_CASE(Single
)
421 VARIANT_EQUAL_CASE(Double
)
422 VARIANT_EQUAL_CASE(UInt8
)
423 VARIANT_EQUAL_CASE(UInt16
)
424 VARIANT_EQUAL_CASE(UInt32
)
425 VARIANT_EQUAL_CASE(UInt64
)
426 VARIANT_EQUAL_CASE(String
)
432 #undef VARIANT_EQUAL_CASE
434 bool operator!=(const Variant
&Other
) const { return !(*this == Other
); }
435 Variant
&operator=(const Variant
&Other
) {
438 if (Type
== PDB_VariantType::String
)
439 delete[] Value
.String
;
442 if (Other
.Type
== PDB_VariantType::String
&&
443 Other
.Value
.String
!= nullptr) {
444 Value
.String
= new char[strlen(Other
.Value
.String
) + 1];
445 ::strcpy(Value
.String
, Other
.Value
.String
);
451 } // end namespace pdb
452 } // end namespace llvm
456 template <> struct hash
<llvm::pdb::PDB_SymType
> {
457 using argument_type
= llvm::pdb::PDB_SymType
;
458 using result_type
= std::size_t;
460 result_type
operator()(const argument_type
&Arg
) const {
461 return std::hash
<int>()(static_cast<int>(Arg
));
465 } // end namespace std
467 #endif // LLVM_DEBUGINFO_PDB_PDBTYPES_H