1 //===- CodeView.h -----------------------------------------------*- C++ -*-===//
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_CODEVIEW_CODEVIEW_H
11 #define LLVM_DEBUGINFO_CODEVIEW_CODEVIEW_H
14 #include <type_traits>
19 /// Distinguishes individual records in .debug$T section or PDB type stream. The
20 /// documentation and headers talk about this as the "leaf" type.
21 enum class TypeRecordKind : uint16_t {
22 #define TYPE_RECORD(lf_ename, value, name) name = value,
23 #include "TypeRecords.def"
24 // FIXME: Add serialization support
28 /// Duplicate copy of the above enum, but using the official CV names. Useful
29 /// for reference purposes and when dealing with unknown record types.
30 enum TypeLeafKind : uint16_t {
31 #define CV_TYPE(name, val) name = val,
32 #include "TypeRecords.def"
35 /// Distinguishes individual records in the Symbols subsection of a .debug$S
36 /// section. Equivalent to SYM_ENUM_e in cvinfo.h.
37 enum class SymbolRecordKind : uint16_t {
38 #define SYMBOL_RECORD(lf_ename, value, name) name = value,
39 #include "CVSymbolTypes.def"
42 /// Duplicate copy of the above enum, but using the official CV names. Useful
43 /// for reference purposes and when dealing with unknown record types.
44 enum SymbolKind : uint16_t {
45 #define CV_SYMBOL(name, val) name = val,
46 #include "CVSymbolTypes.def"
49 #define CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(Class) \
50 inline Class operator|(Class a, Class b) { \
51 return static_cast<Class>( \
52 static_cast<std::underlying_type<Class>::type>(a) | \
53 static_cast<std::underlying_type<Class>::type>(b)); \
55 inline Class operator&(Class a, Class b) { \
56 return static_cast<Class>( \
57 static_cast<std::underlying_type<Class>::type>(a) & \
58 static_cast<std::underlying_type<Class>::type>(b)); \
60 inline Class operator~(Class a) { \
61 return static_cast<Class>( \
62 ~static_cast<std::underlying_type<Class>::type>(a)); \
64 inline Class &operator|=(Class &a, Class b) { \
68 inline Class &operator&=(Class &a, Class b) { \
73 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
74 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
75 enum class CPUType : uint16_t {
134 D3D11_Shader = 0x100,
137 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
138 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
139 enum SourceLanguage : uint8_t {
159 /// These values correspond to the CV_call_e enumeration, and are documented
160 /// at the following locations:
161 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
162 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
164 enum class CallingConvention : uint8_t {
165 NearC = 0x00, // near right to left push, caller pops stack
166 FarC = 0x01, // far right to left push, caller pops stack
167 NearPascal = 0x02, // near left to right push, callee pops stack
168 FarPascal = 0x03, // far left to right push, callee pops stack
169 NearFast = 0x04, // near left to right push with regs, callee pops stack
170 FarFast = 0x05, // far left to right push with regs, callee pops stack
171 NearStdCall = 0x07, // near standard call
172 FarStdCall = 0x08, // far standard call
173 NearSysCall = 0x09, // near sys call
174 FarSysCall = 0x0a, // far sys call
175 ThisCall = 0x0b, // this call (this passed in register)
176 MipsCall = 0x0c, // Mips call
177 Generic = 0x0d, // Generic call sequence
178 AlphaCall = 0x0e, // Alpha call
179 PpcCall = 0x0f, // PPC call
180 SHCall = 0x10, // Hitachi SuperH call
181 ArmCall = 0x11, // ARM call
182 AM33Call = 0x12, // AM33 call
183 TriCall = 0x13, // TriCore Call
184 SH5Call = 0x14, // Hitachi SuperH-5 call
185 M32RCall = 0x15, // M32R Call
186 ClrCall = 0x16, // clr call
188 0x17, // Marker for routines always inlined and thus lacking a convention
189 NearVector = 0x18 // near left to right push with regs, callee pops stack
192 enum class ClassOptions : uint16_t {
195 HasConstructorOrDestructor = 0x0002,
196 HasOverloadedOperator = 0x0004,
198 ContainsNestedClass = 0x0010,
199 HasOverloadedAssignmentOperator = 0x0020,
200 HasConversionOperator = 0x0040,
201 ForwardReference = 0x0080,
203 HasUniqueName = 0x0200,
207 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ClassOptions)
209 enum class FrameProcedureOptions : uint32_t {
211 HasAlloca = 0x00000001,
212 HasSetJmp = 0x00000002,
213 HasLongJmp = 0x00000004,
214 HasInlineAssembly = 0x00000008,
215 HasExceptionHandling = 0x00000010,
216 MarkedInline = 0x00000020,
217 HasStructuredExceptionHandling = 0x00000040,
219 SecurityChecks = 0x00000100,
220 AsynchronousExceptionHandling = 0x00000200,
221 NoStackOrderingForSecurityChecks = 0x00000400,
222 Inlined = 0x00000800,
223 StrictSecurityChecks = 0x00001000,
224 SafeBuffers = 0x00002000,
225 ProfileGuidedOptimization = 0x00040000,
226 ValidProfileCounts = 0x00080000,
227 OptimizedForSpeed = 0x00100000,
228 GuardCfg = 0x00200000,
229 GuardCfw = 0x00400000
231 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(FrameProcedureOptions)
233 enum class FunctionOptions : uint8_t {
237 ConstructorWithVirtualBases = 0x04
239 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(FunctionOptions)
241 enum class HfaKind : uint8_t {
248 /// Source-level access specifier. (CV_access_e)
249 enum class MemberAccess : uint8_t {
256 /// Part of member attribute flags. (CV_methodprop_e)
257 enum class MethodKind : uint8_t {
262 IntroducingVirtual = 0x04,
264 PureIntroducingVirtual = 0x06
267 /// Equivalent to CV_fldattr_t bitfield.
268 enum class MethodOptions : uint16_t {
271 MethodKindMask = 0x001c,
274 NoConstruct = 0x0080,
275 CompilerGenerated = 0x0100,
278 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(MethodOptions)
280 /// Equivalent to CV_modifier_t.
281 enum class ModifierOptions : uint16_t {
287 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ModifierOptions)
289 enum class ModuleSubstreamKind : uint32_t {
294 FileChecksums = 0xf4,
297 CrossScopeImports = 0xf7,
298 CrossScopeExports = 0xf8,
300 // These appear to relate to .Net assembly info.
302 FuncMDTokenMap = 0xfa,
303 TypeMDTokenMap = 0xfb,
304 MergedAssemblyInput = 0xfc,
306 CoffSymbolRVA = 0xfd,
309 /// Equivalent to CV_ptrtype_e.
310 enum class PointerKind : uint8_t {
311 Near16 = 0x00, // 16 bit pointer
312 Far16 = 0x01, // 16:16 far pointer
313 Huge16 = 0x02, // 16:16 huge pointer
314 BasedOnSegment = 0x03, // based on segment
315 BasedOnValue = 0x04, // based on value of base
316 BasedOnSegmentValue = 0x05, // based on segment value of base
317 BasedOnAddress = 0x06, // based on address of base
318 BasedOnSegmentAddress = 0x07, // based on segment address of base
319 BasedOnType = 0x08, // based on type
320 BasedOnSelf = 0x09, // based on self
321 Near32 = 0x0a, // 32 bit pointer
322 Far32 = 0x0b, // 16:32 pointer
323 Near64 = 0x0c // 64 bit pointer
326 /// Equivalent to CV_ptrmode_e.
327 enum class PointerMode : uint8_t {
328 Pointer = 0x00, // "normal" pointer
329 LValueReference = 0x01, // "old" reference
330 PointerToDataMember = 0x02, // pointer to data member
331 PointerToMemberFunction = 0x03, // pointer to member function
332 RValueReference = 0x04 // r-value reference
335 /// Equivalent to misc lfPointerAttr bitfields.
336 enum class PointerOptions : uint32_t {
339 Volatile = 0x00000200,
341 Unaligned = 0x00000800,
342 Restrict = 0x00001000,
343 WinRTSmartPointer = 0x00080000
345 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(PointerOptions)
347 /// Equivalent to CV_pmtype_e.
348 enum class PointerToMemberRepresentation : uint16_t {
349 Unknown = 0x00, // not specified (pre VC8)
350 SingleInheritanceData = 0x01, // member data, single inheritance
351 MultipleInheritanceData = 0x02, // member data, multiple inheritance
352 VirtualInheritanceData = 0x03, // member data, virtual inheritance
353 GeneralData = 0x04, // member data, most general
354 SingleInheritanceFunction = 0x05, // member function, single inheritance
355 MultipleInheritanceFunction = 0x06, // member function, multiple inheritance
356 VirtualInheritanceFunction = 0x07, // member function, virtual inheritance
357 GeneralFunction = 0x08 // member function, most general
360 enum class VFTableSlotKind : uint8_t {
370 enum class WindowsRTClassKind : uint8_t {
377 /// Corresponds to CV_LVARFLAGS bitfield.
378 enum class LocalSymFlags : uint16_t {
380 IsParameter = 1 << 0,
381 IsAddressTaken = 1 << 1,
382 IsCompilerGenerated = 1 << 2,
383 IsAggregate = 1 << 3,
384 IsAggregated = 1 << 4,
387 IsReturnValue = 1 << 7,
388 IsOptimizedOut = 1 << 8,
389 IsEnregisteredGlobal = 1 << 9,
390 IsEnregisteredStatic = 1 << 10,
392 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(LocalSymFlags)
394 /// Corresponds to the CV_PROCFLAGS bitfield.
395 enum class ProcSymFlags : uint8_t {
401 IsUnreachable = 1 << 4,
402 HasCustomCallingConv = 1 << 5,
404 HasOptimizedDebugInfo = 1 << 7,
406 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ProcSymFlags)
408 /// Corresponds to COMPILESYM2::Flags bitfield.
409 enum class CompileSym2Flags : uint32_t {
413 NoDataAlign = 1 << 11,
414 ManagedPresent = 1 << 12,
415 SecurityChecks = 1 << 13,
418 MSILModule = 1 << 16,
420 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym2Flags)
422 /// Corresponds to COMPILESYM3::Flags bitfield.
423 enum class CompileSym3Flags : uint32_t {
427 NoDataAlign = 1 << 11,
428 ManagedPresent = 1 << 12,
429 SecurityChecks = 1 << 13,
432 MSILModule = 1 << 16,
437 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym3Flags)
439 enum class ExportFlags : uint16_t {
444 HasExplicitOrdinal = 1 << 4,
447 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ExportFlags)
449 // Corresponds to BinaryAnnotationOpcode enum.
450 enum class BinaryAnnotationsOpCode : uint32_t {
453 ChangeCodeOffsetBase,
461 ChangeColumnEndDelta,
462 ChangeCodeOffsetAndLineOffset,
463 ChangeCodeLengthAndCodeOffset,
467 // Corresponds to CV_cookietype_e enum.
468 enum class FrameCookieKind : uint8_t {
475 // Corresponds to CV_HREG_e enum.
476 enum class RegisterId : uint16_t {
528 /// These values correspond to the THUNK_ORDINAL enumeration.
529 enum class ThunkOrdinal {
539 enum class TrampolineType { TrampIncremental, BranchIsland };
541 // These values correspond to the CV_SourceChksum_t enumeration.
542 enum class FileChecksumKind : uint8_t { None, MD5, SHA1, SHA256 };
544 enum LineFlags : uint32_t {
545 HaveColumns = 1, // CV_LINES_HAVE_COLUMNS