1 //===- EnumTables.cpp - Enum to string conversion tables ------------------===// 2 // 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 6 // 7 //===----------------------------------------------------------------------===// 8 9 #include "llvm/DebugInfo/CodeView/EnumTables.h" 10 #include "llvm/Support/ScopedPrinter.h" 11 #include <type_traits> 12 13 using namespace llvm; 14 using namespace codeview; 15 16 #define CV_ENUM_CLASS_ENT(enum_class, enum) \ 17 { #enum, std::underlying_type_t<enum_class>(enum_class::enum) } 18 19 #define CV_ENUM_ENT(ns, enum) \ 20 { #enum, ns::enum } 21 22 static const EnumEntry<SymbolKind> SymbolTypeNames[] = { 23 #define CV_SYMBOL(enum, val) {#enum, enum}, 24 #include "llvm/DebugInfo/CodeView/CodeViewSymbols.def" 25 #undef CV_SYMBOL 26 }; 27 28 static const EnumEntry<TypeLeafKind> TypeLeafNames[] = { 29 #define CV_TYPE(name, val) {#name, name}, 30 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def" 31 #undef CV_TYPE 32 }; 33 34 static const EnumEntry<uint16_t> RegisterNames_X86[] = { 35 #define CV_REGISTERS_X86 36 #define CV_REGISTER(name, val) CV_ENUM_CLASS_ENT(RegisterId, name), 37 #include "llvm/DebugInfo/CodeView/CodeViewRegisters.def" 38 #undef CV_REGISTER 39 #undef CV_REGISTERS_X86 40 }; 41 42 static const EnumEntry<uint16_t> RegisterNames_ARM[] = { 43 #define CV_REGISTERS_ARM 44 #define CV_REGISTER(name, val) CV_ENUM_CLASS_ENT(RegisterId, name), 45 #include "llvm/DebugInfo/CodeView/CodeViewRegisters.def" 46 #undef CV_REGISTER 47 #undef CV_REGISTERS_ARM 48 }; 49 50 static const EnumEntry<uint16_t> RegisterNames_ARM64[] = { 51 #define CV_REGISTERS_ARM64 52 #define CV_REGISTER(name, val) CV_ENUM_CLASS_ENT(RegisterId, name), 53 #include "llvm/DebugInfo/CodeView/CodeViewRegisters.def" 54 #undef CV_REGISTER 55 #undef CV_REGISTERS_ARM64 56 }; 57 58 static const EnumEntry<uint32_t> PublicSymFlagNames[] = { 59 CV_ENUM_CLASS_ENT(PublicSymFlags, Code), 60 CV_ENUM_CLASS_ENT(PublicSymFlags, Function), 61 CV_ENUM_CLASS_ENT(PublicSymFlags, Managed), 62 CV_ENUM_CLASS_ENT(PublicSymFlags, MSIL), 63 }; 64 65 static const EnumEntry<uint8_t> ProcSymFlagNames[] = { 66 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFP), 67 CV_ENUM_CLASS_ENT(ProcSymFlags, HasIRET), 68 CV_ENUM_CLASS_ENT(ProcSymFlags, HasFRET), 69 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoReturn), 70 CV_ENUM_CLASS_ENT(ProcSymFlags, IsUnreachable), 71 CV_ENUM_CLASS_ENT(ProcSymFlags, HasCustomCallingConv), 72 CV_ENUM_CLASS_ENT(ProcSymFlags, IsNoInline), 73 CV_ENUM_CLASS_ENT(ProcSymFlags, HasOptimizedDebugInfo), 74 }; 75 76 static const EnumEntry<uint16_t> LocalFlags[] = { 77 CV_ENUM_CLASS_ENT(LocalSymFlags, IsParameter), 78 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAddressTaken), 79 CV_ENUM_CLASS_ENT(LocalSymFlags, IsCompilerGenerated), 80 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregate), 81 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAggregated), 82 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAliased), 83 CV_ENUM_CLASS_ENT(LocalSymFlags, IsAlias), 84 CV_ENUM_CLASS_ENT(LocalSymFlags, IsReturnValue), 85 CV_ENUM_CLASS_ENT(LocalSymFlags, IsOptimizedOut), 86 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredGlobal), 87 CV_ENUM_CLASS_ENT(LocalSymFlags, IsEnregisteredStatic), 88 }; 89 90 static const EnumEntry<uint8_t> FrameCookieKinds[] = { 91 CV_ENUM_CLASS_ENT(FrameCookieKind, Copy), 92 CV_ENUM_CLASS_ENT(FrameCookieKind, XorStackPointer), 93 CV_ENUM_CLASS_ENT(FrameCookieKind, XorFramePointer), 94 CV_ENUM_CLASS_ENT(FrameCookieKind, XorR13), 95 }; 96 97 static const EnumEntry<codeview::SourceLanguage> SourceLanguages[] = { 98 CV_ENUM_ENT(SourceLanguage, C), CV_ENUM_ENT(SourceLanguage, Cpp), 99 CV_ENUM_ENT(SourceLanguage, Fortran), CV_ENUM_ENT(SourceLanguage, Masm), 100 CV_ENUM_ENT(SourceLanguage, Pascal), CV_ENUM_ENT(SourceLanguage, Basic), 101 CV_ENUM_ENT(SourceLanguage, Cobol), CV_ENUM_ENT(SourceLanguage, Link), 102 CV_ENUM_ENT(SourceLanguage, Cvtres), CV_ENUM_ENT(SourceLanguage, Cvtpgd), 103 CV_ENUM_ENT(SourceLanguage, CSharp), CV_ENUM_ENT(SourceLanguage, VB), 104 CV_ENUM_ENT(SourceLanguage, ILAsm), CV_ENUM_ENT(SourceLanguage, Java), 105 CV_ENUM_ENT(SourceLanguage, JScript), CV_ENUM_ENT(SourceLanguage, MSIL), 106 CV_ENUM_ENT(SourceLanguage, HLSL), CV_ENUM_ENT(SourceLanguage, D), 107 CV_ENUM_ENT(SourceLanguage, Swift), CV_ENUM_ENT(SourceLanguage, Rust), 108 CV_ENUM_ENT(SourceLanguage, ObjC), CV_ENUM_ENT(SourceLanguage, ObjCpp), 109 }; 110 111 static const EnumEntry<uint32_t> CompileSym2FlagNames[] = { 112 CV_ENUM_CLASS_ENT(CompileSym2Flags, EC), 113 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDbgInfo), 114 CV_ENUM_CLASS_ENT(CompileSym2Flags, LTCG), 115 CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDataAlign), 116 CV_ENUM_CLASS_ENT(CompileSym2Flags, ManagedPresent), 117 CV_ENUM_CLASS_ENT(CompileSym2Flags, SecurityChecks), 118 CV_ENUM_CLASS_ENT(CompileSym2Flags, HotPatch), 119 CV_ENUM_CLASS_ENT(CompileSym2Flags, CVTCIL), 120 CV_ENUM_CLASS_ENT(CompileSym2Flags, MSILModule), 121 }; 122 123 static const EnumEntry<uint32_t> CompileSym3FlagNames[] = { 124 CV_ENUM_CLASS_ENT(CompileSym3Flags, EC), 125 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDbgInfo), 126 CV_ENUM_CLASS_ENT(CompileSym3Flags, LTCG), 127 CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDataAlign), 128 CV_ENUM_CLASS_ENT(CompileSym3Flags, ManagedPresent), 129 CV_ENUM_CLASS_ENT(CompileSym3Flags, SecurityChecks), 130 CV_ENUM_CLASS_ENT(CompileSym3Flags, HotPatch), 131 CV_ENUM_CLASS_ENT(CompileSym3Flags, CVTCIL), 132 CV_ENUM_CLASS_ENT(CompileSym3Flags, MSILModule), 133 CV_ENUM_CLASS_ENT(CompileSym3Flags, Sdl), 134 CV_ENUM_CLASS_ENT(CompileSym3Flags, PGO), 135 CV_ENUM_CLASS_ENT(CompileSym3Flags, Exp), 136 }; 137 138 static const EnumEntry<uint32_t> FileChecksumNames[] = { 139 CV_ENUM_CLASS_ENT(FileChecksumKind, None), 140 CV_ENUM_CLASS_ENT(FileChecksumKind, MD5), 141 CV_ENUM_CLASS_ENT(FileChecksumKind, SHA1), 142 CV_ENUM_CLASS_ENT(FileChecksumKind, SHA256), 143 }; 144 145 static const EnumEntry<unsigned> CPUTypeNames[] = { 146 CV_ENUM_CLASS_ENT(CPUType, Intel8080), 147 CV_ENUM_CLASS_ENT(CPUType, Intel8086), 148 CV_ENUM_CLASS_ENT(CPUType, Intel80286), 149 CV_ENUM_CLASS_ENT(CPUType, Intel80386), 150 CV_ENUM_CLASS_ENT(CPUType, Intel80486), 151 CV_ENUM_CLASS_ENT(CPUType, Pentium), 152 CV_ENUM_CLASS_ENT(CPUType, PentiumPro), 153 CV_ENUM_CLASS_ENT(CPUType, Pentium3), 154 CV_ENUM_CLASS_ENT(CPUType, MIPS), 155 CV_ENUM_CLASS_ENT(CPUType, MIPS16), 156 CV_ENUM_CLASS_ENT(CPUType, MIPS32), 157 CV_ENUM_CLASS_ENT(CPUType, MIPS64), 158 CV_ENUM_CLASS_ENT(CPUType, MIPSI), 159 CV_ENUM_CLASS_ENT(CPUType, MIPSII), 160 CV_ENUM_CLASS_ENT(CPUType, MIPSIII), 161 CV_ENUM_CLASS_ENT(CPUType, MIPSIV), 162 CV_ENUM_CLASS_ENT(CPUType, MIPSV), 163 CV_ENUM_CLASS_ENT(CPUType, M68000), 164 CV_ENUM_CLASS_ENT(CPUType, M68010), 165 CV_ENUM_CLASS_ENT(CPUType, M68020), 166 CV_ENUM_CLASS_ENT(CPUType, M68030), 167 CV_ENUM_CLASS_ENT(CPUType, M68040), 168 CV_ENUM_CLASS_ENT(CPUType, Alpha), 169 CV_ENUM_CLASS_ENT(CPUType, Alpha21164), 170 CV_ENUM_CLASS_ENT(CPUType, Alpha21164A), 171 CV_ENUM_CLASS_ENT(CPUType, Alpha21264), 172 CV_ENUM_CLASS_ENT(CPUType, Alpha21364), 173 CV_ENUM_CLASS_ENT(CPUType, PPC601), 174 CV_ENUM_CLASS_ENT(CPUType, PPC603), 175 CV_ENUM_CLASS_ENT(CPUType, PPC604), 176 CV_ENUM_CLASS_ENT(CPUType, PPC620), 177 CV_ENUM_CLASS_ENT(CPUType, PPCFP), 178 CV_ENUM_CLASS_ENT(CPUType, PPCBE), 179 CV_ENUM_CLASS_ENT(CPUType, SH3), 180 CV_ENUM_CLASS_ENT(CPUType, SH3E), 181 CV_ENUM_CLASS_ENT(CPUType, SH3DSP), 182 CV_ENUM_CLASS_ENT(CPUType, SH4), 183 CV_ENUM_CLASS_ENT(CPUType, SHMedia), 184 CV_ENUM_CLASS_ENT(CPUType, ARM3), 185 CV_ENUM_CLASS_ENT(CPUType, ARM4), 186 CV_ENUM_CLASS_ENT(CPUType, ARM4T), 187 CV_ENUM_CLASS_ENT(CPUType, ARM5), 188 CV_ENUM_CLASS_ENT(CPUType, ARM5T), 189 CV_ENUM_CLASS_ENT(CPUType, ARM6), 190 CV_ENUM_CLASS_ENT(CPUType, ARM_XMAC), 191 CV_ENUM_CLASS_ENT(CPUType, ARM_WMMX), 192 CV_ENUM_CLASS_ENT(CPUType, ARM7), 193 CV_ENUM_CLASS_ENT(CPUType, Omni), 194 CV_ENUM_CLASS_ENT(CPUType, Ia64), 195 CV_ENUM_CLASS_ENT(CPUType, Ia64_2), 196 CV_ENUM_CLASS_ENT(CPUType, CEE), 197 CV_ENUM_CLASS_ENT(CPUType, AM33), 198 CV_ENUM_CLASS_ENT(CPUType, M32R), 199 CV_ENUM_CLASS_ENT(CPUType, TriCore), 200 CV_ENUM_CLASS_ENT(CPUType, X64), 201 CV_ENUM_CLASS_ENT(CPUType, EBC), 202 CV_ENUM_CLASS_ENT(CPUType, Thumb), 203 CV_ENUM_CLASS_ENT(CPUType, ARMNT), 204 CV_ENUM_CLASS_ENT(CPUType, ARM64), 205 CV_ENUM_CLASS_ENT(CPUType, HybridX86ARM64), 206 CV_ENUM_CLASS_ENT(CPUType, ARM64EC), 207 CV_ENUM_CLASS_ENT(CPUType, ARM64X), 208 CV_ENUM_CLASS_ENT(CPUType, D3D11_Shader), 209 }; 210 211 static const EnumEntry<uint32_t> FrameProcSymFlagNames[] = { 212 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasAlloca), 213 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasSetJmp), 214 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasLongJmp), 215 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasInlineAssembly), 216 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasExceptionHandling), 217 CV_ENUM_CLASS_ENT(FrameProcedureOptions, MarkedInline), 218 CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasStructuredExceptionHandling), 219 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Naked), 220 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SecurityChecks), 221 CV_ENUM_CLASS_ENT(FrameProcedureOptions, AsynchronousExceptionHandling), 222 CV_ENUM_CLASS_ENT(FrameProcedureOptions, NoStackOrderingForSecurityChecks), 223 CV_ENUM_CLASS_ENT(FrameProcedureOptions, Inlined), 224 CV_ENUM_CLASS_ENT(FrameProcedureOptions, StrictSecurityChecks), 225 CV_ENUM_CLASS_ENT(FrameProcedureOptions, SafeBuffers), 226 CV_ENUM_CLASS_ENT(FrameProcedureOptions, EncodedLocalBasePointerMask), 227 CV_ENUM_CLASS_ENT(FrameProcedureOptions, EncodedParamBasePointerMask), 228 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ProfileGuidedOptimization), 229 CV_ENUM_CLASS_ENT(FrameProcedureOptions, ValidProfileCounts), 230 CV_ENUM_CLASS_ENT(FrameProcedureOptions, OptimizedForSpeed), 231 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfg), 232 CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfw), 233 }; 234 235 static const EnumEntry<uint32_t> ModuleSubstreamKindNames[] = { 236 CV_ENUM_CLASS_ENT(DebugSubsectionKind, None), 237 CV_ENUM_CLASS_ENT(DebugSubsectionKind, Symbols), 238 CV_ENUM_CLASS_ENT(DebugSubsectionKind, Lines), 239 CV_ENUM_CLASS_ENT(DebugSubsectionKind, StringTable), 240 CV_ENUM_CLASS_ENT(DebugSubsectionKind, FileChecksums), 241 CV_ENUM_CLASS_ENT(DebugSubsectionKind, FrameData), 242 CV_ENUM_CLASS_ENT(DebugSubsectionKind, InlineeLines), 243 CV_ENUM_CLASS_ENT(DebugSubsectionKind, CrossScopeImports), 244 CV_ENUM_CLASS_ENT(DebugSubsectionKind, CrossScopeExports), 245 CV_ENUM_CLASS_ENT(DebugSubsectionKind, ILLines), 246 CV_ENUM_CLASS_ENT(DebugSubsectionKind, FuncMDTokenMap), 247 CV_ENUM_CLASS_ENT(DebugSubsectionKind, TypeMDTokenMap), 248 CV_ENUM_CLASS_ENT(DebugSubsectionKind, MergedAssemblyInput), 249 CV_ENUM_CLASS_ENT(DebugSubsectionKind, CoffSymbolRVA), 250 }; 251 252 static const EnumEntry<uint16_t> ExportSymFlagNames[] = { 253 CV_ENUM_CLASS_ENT(ExportFlags, IsConstant), 254 CV_ENUM_CLASS_ENT(ExportFlags, IsData), 255 CV_ENUM_CLASS_ENT(ExportFlags, IsPrivate), 256 CV_ENUM_CLASS_ENT(ExportFlags, HasNoName), 257 CV_ENUM_CLASS_ENT(ExportFlags, HasExplicitOrdinal), 258 CV_ENUM_CLASS_ENT(ExportFlags, IsForwarder), 259 }; 260 261 static const EnumEntry<uint8_t> ThunkOrdinalNames[] = { 262 CV_ENUM_CLASS_ENT(ThunkOrdinal, Standard), 263 CV_ENUM_CLASS_ENT(ThunkOrdinal, ThisAdjustor), 264 CV_ENUM_CLASS_ENT(ThunkOrdinal, Vcall), 265 CV_ENUM_CLASS_ENT(ThunkOrdinal, Pcode), 266 CV_ENUM_CLASS_ENT(ThunkOrdinal, UnknownLoad), 267 CV_ENUM_CLASS_ENT(ThunkOrdinal, TrampIncremental), 268 CV_ENUM_CLASS_ENT(ThunkOrdinal, BranchIsland), 269 }; 270 271 static const EnumEntry<uint16_t> TrampolineNames[] = { 272 CV_ENUM_CLASS_ENT(TrampolineType, TrampIncremental), 273 CV_ENUM_CLASS_ENT(TrampolineType, BranchIsland), 274 }; 275 276 static const EnumEntry<COFF::SectionCharacteristics> 277 ImageSectionCharacteristicNames[] = { 278 CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NOLOAD), 279 CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NO_PAD), 280 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_CODE), 281 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_INITIALIZED_DATA), 282 CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_UNINITIALIZED_DATA), 283 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_OTHER), 284 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_INFO), 285 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_REMOVE), 286 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_COMDAT), 287 CV_ENUM_ENT(COFF, IMAGE_SCN_GPREL), 288 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PURGEABLE), 289 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_16BIT), 290 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_LOCKED), 291 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PRELOAD), 292 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1BYTES), 293 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2BYTES), 294 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4BYTES), 295 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8BYTES), 296 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_16BYTES), 297 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_32BYTES), 298 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_64BYTES), 299 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_128BYTES), 300 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_256BYTES), 301 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_512BYTES), 302 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1024BYTES), 303 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2048BYTES), 304 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4096BYTES), 305 CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8192BYTES), 306 CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_NRELOC_OVFL), 307 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_DISCARDABLE), 308 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_CACHED), 309 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_PAGED), 310 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_SHARED), 311 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_EXECUTE), 312 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_READ), 313 CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_WRITE)}; 314 315 static const EnumEntry<uint16_t> ClassOptionNames[] = { 316 CV_ENUM_CLASS_ENT(ClassOptions, Packed), 317 CV_ENUM_CLASS_ENT(ClassOptions, HasConstructorOrDestructor), 318 CV_ENUM_CLASS_ENT(ClassOptions, HasOverloadedOperator), 319 CV_ENUM_CLASS_ENT(ClassOptions, Nested), 320 CV_ENUM_CLASS_ENT(ClassOptions, ContainsNestedClass), 321 CV_ENUM_CLASS_ENT(ClassOptions, HasOverloadedAssignmentOperator), 322 CV_ENUM_CLASS_ENT(ClassOptions, HasConversionOperator), 323 CV_ENUM_CLASS_ENT(ClassOptions, ForwardReference), 324 CV_ENUM_CLASS_ENT(ClassOptions, Scoped), 325 CV_ENUM_CLASS_ENT(ClassOptions, HasUniqueName), 326 CV_ENUM_CLASS_ENT(ClassOptions, Sealed), 327 CV_ENUM_CLASS_ENT(ClassOptions, Intrinsic), 328 }; 329 330 static const EnumEntry<uint8_t> MemberAccessNames[] = { 331 CV_ENUM_CLASS_ENT(MemberAccess, None), 332 CV_ENUM_CLASS_ENT(MemberAccess, Private), 333 CV_ENUM_CLASS_ENT(MemberAccess, Protected), 334 CV_ENUM_CLASS_ENT(MemberAccess, Public), 335 }; 336 337 static const EnumEntry<uint16_t> MethodOptionNames[] = { 338 CV_ENUM_CLASS_ENT(MethodOptions, Pseudo), 339 CV_ENUM_CLASS_ENT(MethodOptions, NoInherit), 340 CV_ENUM_CLASS_ENT(MethodOptions, NoConstruct), 341 CV_ENUM_CLASS_ENT(MethodOptions, CompilerGenerated), 342 CV_ENUM_CLASS_ENT(MethodOptions, Sealed), 343 }; 344 345 static const EnumEntry<uint16_t> MemberKindNames[] = { 346 CV_ENUM_CLASS_ENT(MethodKind, Vanilla), 347 CV_ENUM_CLASS_ENT(MethodKind, Virtual), 348 CV_ENUM_CLASS_ENT(MethodKind, Static), 349 CV_ENUM_CLASS_ENT(MethodKind, Friend), 350 CV_ENUM_CLASS_ENT(MethodKind, IntroducingVirtual), 351 CV_ENUM_CLASS_ENT(MethodKind, PureVirtual), 352 CV_ENUM_CLASS_ENT(MethodKind, PureIntroducingVirtual), 353 }; 354 355 static const EnumEntry<uint8_t> PtrKindNames[] = { 356 CV_ENUM_CLASS_ENT(PointerKind, Near16), 357 CV_ENUM_CLASS_ENT(PointerKind, Far16), 358 CV_ENUM_CLASS_ENT(PointerKind, Huge16), 359 CV_ENUM_CLASS_ENT(PointerKind, BasedOnSegment), 360 CV_ENUM_CLASS_ENT(PointerKind, BasedOnValue), 361 CV_ENUM_CLASS_ENT(PointerKind, BasedOnSegmentValue), 362 CV_ENUM_CLASS_ENT(PointerKind, BasedOnAddress), 363 CV_ENUM_CLASS_ENT(PointerKind, BasedOnSegmentAddress), 364 CV_ENUM_CLASS_ENT(PointerKind, BasedOnType), 365 CV_ENUM_CLASS_ENT(PointerKind, BasedOnSelf), 366 CV_ENUM_CLASS_ENT(PointerKind, Near32), 367 CV_ENUM_CLASS_ENT(PointerKind, Far32), 368 CV_ENUM_CLASS_ENT(PointerKind, Near64), 369 }; 370 371 static const EnumEntry<uint8_t> PtrModeNames[] = { 372 CV_ENUM_CLASS_ENT(PointerMode, Pointer), 373 CV_ENUM_CLASS_ENT(PointerMode, LValueReference), 374 CV_ENUM_CLASS_ENT(PointerMode, PointerToDataMember), 375 CV_ENUM_CLASS_ENT(PointerMode, PointerToMemberFunction), 376 CV_ENUM_CLASS_ENT(PointerMode, RValueReference), 377 }; 378 379 static const EnumEntry<uint16_t> PtrMemberRepNames[] = { 380 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, Unknown), 381 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, SingleInheritanceData), 382 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, MultipleInheritanceData), 383 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, VirtualInheritanceData), 384 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, GeneralData), 385 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, SingleInheritanceFunction), 386 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, 387 MultipleInheritanceFunction), 388 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, 389 VirtualInheritanceFunction), 390 CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, GeneralFunction), 391 }; 392 393 static const EnumEntry<uint16_t> TypeModifierNames[] = { 394 CV_ENUM_CLASS_ENT(ModifierOptions, Const), 395 CV_ENUM_CLASS_ENT(ModifierOptions, Volatile), 396 CV_ENUM_CLASS_ENT(ModifierOptions, Unaligned), 397 }; 398 399 static const EnumEntry<uint8_t> CallingConventions[] = { 400 CV_ENUM_CLASS_ENT(CallingConvention, NearC), 401 CV_ENUM_CLASS_ENT(CallingConvention, FarC), 402 CV_ENUM_CLASS_ENT(CallingConvention, NearPascal), 403 CV_ENUM_CLASS_ENT(CallingConvention, FarPascal), 404 CV_ENUM_CLASS_ENT(CallingConvention, NearFast), 405 CV_ENUM_CLASS_ENT(CallingConvention, FarFast), 406 CV_ENUM_CLASS_ENT(CallingConvention, NearStdCall), 407 CV_ENUM_CLASS_ENT(CallingConvention, FarStdCall), 408 CV_ENUM_CLASS_ENT(CallingConvention, NearSysCall), 409 CV_ENUM_CLASS_ENT(CallingConvention, FarSysCall), 410 CV_ENUM_CLASS_ENT(CallingConvention, ThisCall), 411 CV_ENUM_CLASS_ENT(CallingConvention, MipsCall), 412 CV_ENUM_CLASS_ENT(CallingConvention, Generic), 413 CV_ENUM_CLASS_ENT(CallingConvention, AlphaCall), 414 CV_ENUM_CLASS_ENT(CallingConvention, PpcCall), 415 CV_ENUM_CLASS_ENT(CallingConvention, SHCall), 416 CV_ENUM_CLASS_ENT(CallingConvention, ArmCall), 417 CV_ENUM_CLASS_ENT(CallingConvention, AM33Call), 418 CV_ENUM_CLASS_ENT(CallingConvention, TriCall), 419 CV_ENUM_CLASS_ENT(CallingConvention, SH5Call), 420 CV_ENUM_CLASS_ENT(CallingConvention, M32RCall), 421 CV_ENUM_CLASS_ENT(CallingConvention, ClrCall), 422 CV_ENUM_CLASS_ENT(CallingConvention, Inline), 423 CV_ENUM_CLASS_ENT(CallingConvention, NearVector), 424 }; 425 426 static const EnumEntry<uint8_t> FunctionOptionEnum[] = { 427 CV_ENUM_CLASS_ENT(FunctionOptions, CxxReturnUdt), 428 CV_ENUM_CLASS_ENT(FunctionOptions, Constructor), 429 CV_ENUM_CLASS_ENT(FunctionOptions, ConstructorWithVirtualBases), 430 }; 431 432 static const EnumEntry<uint16_t> LabelTypeEnum[] = { 433 CV_ENUM_CLASS_ENT(LabelType, Near), 434 CV_ENUM_CLASS_ENT(LabelType, Far), 435 }; 436 437 static const EnumEntry<uint16_t> JumpTableEntrySizeNames[] = { 438 CV_ENUM_CLASS_ENT(JumpTableEntrySize, Int8), 439 CV_ENUM_CLASS_ENT(JumpTableEntrySize, UInt8), 440 CV_ENUM_CLASS_ENT(JumpTableEntrySize, Int16), 441 CV_ENUM_CLASS_ENT(JumpTableEntrySize, UInt16), 442 CV_ENUM_CLASS_ENT(JumpTableEntrySize, Int32), 443 CV_ENUM_CLASS_ENT(JumpTableEntrySize, UInt32), 444 CV_ENUM_CLASS_ENT(JumpTableEntrySize, Pointer), 445 CV_ENUM_CLASS_ENT(JumpTableEntrySize, UInt8ShiftLeft), 446 CV_ENUM_CLASS_ENT(JumpTableEntrySize, UInt16ShiftLeft), 447 CV_ENUM_CLASS_ENT(JumpTableEntrySize, Int8ShiftLeft), 448 CV_ENUM_CLASS_ENT(JumpTableEntrySize, Int16ShiftLeft), 449 }; 450 451 namespace llvm { 452 namespace codeview { 453 454 ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames() { 455 return ArrayRef(SymbolTypeNames); 456 } 457 458 ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames() { 459 return ArrayRef(TypeLeafNames); 460 } 461 462 ArrayRef<EnumEntry<uint16_t>> getRegisterNames(CPUType Cpu) { 463 if (Cpu == CPUType::ARMNT) { 464 return ArrayRef(RegisterNames_ARM); 465 } else if (Cpu == CPUType::ARM64) { 466 return ArrayRef(RegisterNames_ARM64); 467 } 468 return ArrayRef(RegisterNames_X86); 469 } 470 471 ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames() { 472 return ArrayRef(PublicSymFlagNames); 473 } 474 475 ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames() { 476 return ArrayRef(ProcSymFlagNames); 477 } 478 479 ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames() { 480 return ArrayRef(LocalFlags); 481 } 482 483 ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames() { 484 return ArrayRef(FrameCookieKinds); 485 } 486 487 ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames() { 488 return ArrayRef(SourceLanguages); 489 } 490 491 ArrayRef<EnumEntry<uint32_t>> getCompileSym2FlagNames() { 492 return ArrayRef(CompileSym2FlagNames); 493 } 494 495 ArrayRef<EnumEntry<uint32_t>> getCompileSym3FlagNames() { 496 return ArrayRef(CompileSym3FlagNames); 497 } 498 499 ArrayRef<EnumEntry<uint32_t>> getFileChecksumNames() { 500 return ArrayRef(FileChecksumNames); 501 } 502 503 ArrayRef<EnumEntry<unsigned>> getCPUTypeNames() { 504 return ArrayRef(CPUTypeNames); 505 } 506 507 ArrayRef<EnumEntry<uint32_t>> getFrameProcSymFlagNames() { 508 return ArrayRef(FrameProcSymFlagNames); 509 } 510 511 ArrayRef<EnumEntry<uint16_t>> getExportSymFlagNames() { 512 return ArrayRef(ExportSymFlagNames); 513 } 514 515 ArrayRef<EnumEntry<uint32_t>> getModuleSubstreamKindNames() { 516 return ArrayRef(ModuleSubstreamKindNames); 517 } 518 519 ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames() { 520 return ArrayRef(ThunkOrdinalNames); 521 } 522 523 ArrayRef<EnumEntry<uint16_t>> getTrampolineNames() { 524 return ArrayRef(TrampolineNames); 525 } 526 527 ArrayRef<EnumEntry<COFF::SectionCharacteristics>> 528 getImageSectionCharacteristicNames() { 529 return ArrayRef(ImageSectionCharacteristicNames); 530 } 531 532 ArrayRef<EnumEntry<uint16_t>> getClassOptionNames() { 533 return ArrayRef(ClassOptionNames); 534 } 535 536 ArrayRef<EnumEntry<uint8_t>> getMemberAccessNames() { 537 return ArrayRef(MemberAccessNames); 538 } 539 540 ArrayRef<EnumEntry<uint16_t>> getMethodOptionNames() { 541 return ArrayRef(MethodOptionNames); 542 } 543 544 ArrayRef<EnumEntry<uint16_t>> getMemberKindNames() { 545 return ArrayRef(MemberKindNames); 546 } 547 548 ArrayRef<EnumEntry<uint8_t>> getPtrKindNames() { 549 return ArrayRef(PtrKindNames); 550 } 551 552 ArrayRef<EnumEntry<uint8_t>> getPtrModeNames() { 553 return ArrayRef(PtrModeNames); 554 } 555 556 ArrayRef<EnumEntry<uint16_t>> getPtrMemberRepNames() { 557 return ArrayRef(PtrMemberRepNames); 558 } 559 560 ArrayRef<EnumEntry<uint16_t>> getTypeModifierNames() { 561 return ArrayRef(TypeModifierNames); 562 } 563 564 ArrayRef<EnumEntry<uint8_t>> getCallingConventions() { 565 return ArrayRef(CallingConventions); 566 } 567 568 ArrayRef<EnumEntry<uint8_t>> getFunctionOptionEnum() { 569 return ArrayRef(FunctionOptionEnum); 570 } 571 572 ArrayRef<EnumEntry<uint16_t>> getLabelTypeEnum() { 573 return ArrayRef(LabelTypeEnum); 574 } 575 576 ArrayRef<EnumEntry<uint16_t>> getJumpTableEntrySizeNames() { 577 return ArrayRef(JumpTableEntrySizeNames); 578 } 579 580 } // end namespace codeview 581 } // end namespace llvm 582