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"
26 /// Duplicate copy of the above enum, but using the official CV names. Useful
27 /// for reference purposes and when dealing with unknown record types.
28 enum TypeLeafKind : uint16_t {
29 #define CV_TYPE(name, val) name = val,
30 #include "TypeRecords.def"
33 /// Distinguishes individual records in the Symbols subsection of a .debug$S
34 /// section. Equivalent to SYM_ENUM_e in cvinfo.h.
35 enum class SymbolRecordKind : uint16_t {
36 #define SYMBOL_RECORD(lf_ename, value, name) name = value,
37 #include "CVSymbolTypes.def"
40 /// Duplicate copy of the above enum, but using the official CV names. Useful
41 /// for reference purposes and when dealing with unknown record types.
42 enum SymbolKind : uint16_t {
43 #define CV_SYMBOL(name, val) name = val,
44 #include "CVSymbolTypes.def"
47 #define CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(Class) \
48 inline Class operator|(Class a, Class b) { \
49 return static_cast<Class>( \
50 static_cast<std::underlying_type<Class>::type>(a) | \
51 static_cast<std::underlying_type<Class>::type>(b)); \
53 inline Class operator&(Class a, Class b) { \
54 return static_cast<Class>( \
55 static_cast<std::underlying_type<Class>::type>(a) & \
56 static_cast<std::underlying_type<Class>::type>(b)); \
58 inline Class operator~(Class a) { \
59 return static_cast<Class>( \
60 ~static_cast<std::underlying_type<Class>::type>(a)); \
62 inline Class &operator|=(Class &a, Class b) { \
66 inline Class &operator&=(Class &a, Class b) { \
71 /// These values correspond to the CV_CPU_TYPE_e enumeration, and are documented
72 /// here: https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
73 enum class CPUType : uint16_t {
132 D3D11_Shader = 0x100,
135 /// These values correspond to the CV_CFL_LANG enumeration, and are documented
136 /// here: https://msdn.microsoft.com/en-us/library/bw3aekw6.aspx
137 enum SourceLanguage : uint8_t {
157 /// These values correspond to the CV_call_e enumeration, and are documented
158 /// at the following locations:
159 /// https://msdn.microsoft.com/en-us/library/b2fc64ek.aspx
160 /// https://msdn.microsoft.com/en-us/library/windows/desktop/ms680207(v=vs.85).aspx
162 enum class CallingConvention : uint8_t {
163 NearC = 0x00, // near right to left push, caller pops stack
164 FarC = 0x01, // far right to left push, caller pops stack
165 NearPascal = 0x02, // near left to right push, callee pops stack
166 FarPascal = 0x03, // far left to right push, callee pops stack
167 NearFast = 0x04, // near left to right push with regs, callee pops stack
168 FarFast = 0x05, // far left to right push with regs, callee pops stack
169 NearStdCall = 0x07, // near standard call
170 FarStdCall = 0x08, // far standard call
171 NearSysCall = 0x09, // near sys call
172 FarSysCall = 0x0a, // far sys call
173 ThisCall = 0x0b, // this call (this passed in register)
174 MipsCall = 0x0c, // Mips call
175 Generic = 0x0d, // Generic call sequence
176 AlphaCall = 0x0e, // Alpha call
177 PpcCall = 0x0f, // PPC call
178 SHCall = 0x10, // Hitachi SuperH call
179 ArmCall = 0x11, // ARM call
180 AM33Call = 0x12, // AM33 call
181 TriCall = 0x13, // TriCore Call
182 SH5Call = 0x14, // Hitachi SuperH-5 call
183 M32RCall = 0x15, // M32R Call
184 ClrCall = 0x16, // clr call
186 0x17, // Marker for routines always inlined and thus lacking a convention
187 NearVector = 0x18 // near left to right push with regs, callee pops stack
190 enum class ClassOptions : uint16_t {
193 HasConstructorOrDestructor = 0x0002,
194 HasOverloadedOperator = 0x0004,
196 ContainsNestedClass = 0x0010,
197 HasOverloadedAssignmentOperator = 0x0020,
198 HasConversionOperator = 0x0040,
199 ForwardReference = 0x0080,
201 HasUniqueName = 0x0200,
205 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ClassOptions)
207 enum class FrameProcedureOptions : uint32_t {
209 HasAlloca = 0x00000001,
210 HasSetJmp = 0x00000002,
211 HasLongJmp = 0x00000004,
212 HasInlineAssembly = 0x00000008,
213 HasExceptionHandling = 0x00000010,
214 MarkedInline = 0x00000020,
215 HasStructuredExceptionHandling = 0x00000040,
217 SecurityChecks = 0x00000100,
218 AsynchronousExceptionHandling = 0x00000200,
219 NoStackOrderingForSecurityChecks = 0x00000400,
220 Inlined = 0x00000800,
221 StrictSecurityChecks = 0x00001000,
222 SafeBuffers = 0x00002000,
223 ProfileGuidedOptimization = 0x00040000,
224 ValidProfileCounts = 0x00080000,
225 OptimizedForSpeed = 0x00100000,
226 GuardCfg = 0x00200000,
227 GuardCfw = 0x00400000
229 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(FrameProcedureOptions)
231 enum class FunctionOptions : uint8_t {
235 ConstructorWithVirtualBases = 0x04
237 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(FunctionOptions)
239 enum class HfaKind : uint8_t {
246 /// Source-level access specifier. (CV_access_e)
247 enum class MemberAccess : uint8_t {
254 /// Part of member attribute flags. (CV_methodprop_e)
255 enum class MethodKind : uint8_t {
260 IntroducingVirtual = 0x04,
262 PureIntroducingVirtual = 0x06
265 /// Equivalent to CV_fldattr_t bitfield.
266 enum class MethodOptions : uint16_t {
269 MethodKindMask = 0x001c,
272 NoConstruct = 0x0080,
273 CompilerGenerated = 0x0100,
276 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(MethodOptions)
278 /// Equivalent to CV_modifier_t.
279 /// TODO: Add flag for _Atomic modifier
280 enum class ModifierOptions : uint16_t {
286 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ModifierOptions)
288 enum class ModuleSubstreamKind : uint32_t {
293 FileChecksums = 0xf4,
296 CrossScopeImports = 0xf7,
297 CrossScopeExports = 0xf8,
299 // These appear to relate to .Net assembly info.
301 FuncMDTokenMap = 0xfa,
302 TypeMDTokenMap = 0xfb,
303 MergedAssemblyInput = 0xfc,
305 CoffSymbolRVA = 0xfd,
308 /// Equivalent to CV_ptrtype_e.
309 enum class PointerKind : uint8_t {
310 Near16 = 0x00, // 16 bit pointer
311 Far16 = 0x01, // 16:16 far pointer
312 Huge16 = 0x02, // 16:16 huge pointer
313 BasedOnSegment = 0x03, // based on segment
314 BasedOnValue = 0x04, // based on value of base
315 BasedOnSegmentValue = 0x05, // based on segment value of base
316 BasedOnAddress = 0x06, // based on address of base
317 BasedOnSegmentAddress = 0x07, // based on segment address of base
318 BasedOnType = 0x08, // based on type
319 BasedOnSelf = 0x09, // based on self
320 Near32 = 0x0a, // 32 bit pointer
321 Far32 = 0x0b, // 16:32 pointer
322 Near64 = 0x0c // 64 bit pointer
325 /// Equivalent to CV_ptrmode_e.
326 enum class PointerMode : uint8_t {
327 Pointer = 0x00, // "normal" pointer
328 LValueReference = 0x01, // "old" reference
329 PointerToDataMember = 0x02, // pointer to data member
330 PointerToMemberFunction = 0x03, // pointer to member function
331 RValueReference = 0x04 // r-value reference
334 /// Equivalent to misc lfPointerAttr bitfields.
335 enum class PointerOptions : uint32_t {
338 Volatile = 0x00000200,
340 Unaligned = 0x00000800,
341 Restrict = 0x00001000,
342 WinRTSmartPointer = 0x00080000
344 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(PointerOptions)
346 /// Equivalent to CV_pmtype_e.
347 enum class PointerToMemberRepresentation : uint16_t {
348 Unknown = 0x00, // not specified (pre VC8)
349 SingleInheritanceData = 0x01, // member data, single inheritance
350 MultipleInheritanceData = 0x02, // member data, multiple inheritance
351 VirtualInheritanceData = 0x03, // member data, virtual inheritance
352 GeneralData = 0x04, // member data, most general
353 SingleInheritanceFunction = 0x05, // member function, single inheritance
354 MultipleInheritanceFunction = 0x06, // member function, multiple inheritance
355 VirtualInheritanceFunction = 0x07, // member function, virtual inheritance
356 GeneralFunction = 0x08 // member function, most general
359 enum class VFTableSlotKind : uint8_t {
369 enum class WindowsRTClassKind : uint8_t {
376 /// Corresponds to CV_LVARFLAGS bitfield.
377 enum class LocalSymFlags : uint16_t {
379 IsParameter = 1 << 0,
380 IsAddressTaken = 1 << 1,
381 IsCompilerGenerated = 1 << 2,
382 IsAggregate = 1 << 3,
383 IsAggregated = 1 << 4,
386 IsReturnValue = 1 << 7,
387 IsOptimizedOut = 1 << 8,
388 IsEnregisteredGlobal = 1 << 9,
389 IsEnregisteredStatic = 1 << 10,
391 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(LocalSymFlags)
393 /// Corresponds to the CV_PROCFLAGS bitfield.
394 enum class ProcSymFlags : uint8_t {
400 IsUnreachable = 1 << 4,
401 HasCustomCallingConv = 1 << 5,
403 HasOptimizedDebugInfo = 1 << 7,
405 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ProcSymFlags)
407 /// Corresponds to COMPILESYM2::Flags bitfield.
408 enum class CompileSym2Flags : uint32_t {
412 NoDataAlign = 1 << 11,
413 ManagedPresent = 1 << 12,
414 SecurityChecks = 1 << 13,
417 MSILModule = 1 << 16,
419 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym2Flags)
421 /// Corresponds to COMPILESYM3::Flags bitfield.
422 enum class CompileSym3Flags : uint32_t {
426 NoDataAlign = 1 << 11,
427 ManagedPresent = 1 << 12,
428 SecurityChecks = 1 << 13,
431 MSILModule = 1 << 16,
436 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(CompileSym3Flags)
438 enum class ExportFlags : uint16_t {
443 HasExplicitOrdinal = 1 << 4,
446 CV_DEFINE_ENUM_CLASS_FLAGS_OPERATORS(ExportFlags)
448 // Corresponds to BinaryAnnotationOpcode enum.
449 enum class BinaryAnnotationsOpCode : uint32_t {
452 ChangeCodeOffsetBase,
460 ChangeColumnEndDelta,
461 ChangeCodeOffsetAndLineOffset,
462 ChangeCodeLengthAndCodeOffset,
466 // Corresponds to CV_cookietype_e enum.
467 enum class FrameCookieKind : uint8_t {
474 // Corresponds to CV_HREG_e enum.
475 enum class RegisterId : uint16_t {
527 /// These values correspond to the THUNK_ORDINAL enumeration.
528 enum class ThunkOrdinal : uint8_t {
538 enum class TrampolineType : uint16_t { TrampIncremental, BranchIsland };
540 // These values correspond to the CV_SourceChksum_t enumeration.
541 enum class FileChecksumKind : uint8_t { None, MD5, SHA1, SHA256 };
543 enum LineFlags : uint32_t {
544 HaveColumns = 1, // CV_LINES_HAVE_COLUMNS