EnumTables.cpp 21 KB

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