xref: /freebsd/contrib/llvm-project/llvm/lib/DebugInfo/CodeView/EnumTables.cpp (revision 8ddb146abcdf061be9f2c0db7e391697dafad85c)
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 < enum_class > ::type(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 };
109 
110 static const EnumEntry<uint32_t> CompileSym2FlagNames[] = {
111     CV_ENUM_CLASS_ENT(CompileSym2Flags, EC),
112     CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDbgInfo),
113     CV_ENUM_CLASS_ENT(CompileSym2Flags, LTCG),
114     CV_ENUM_CLASS_ENT(CompileSym2Flags, NoDataAlign),
115     CV_ENUM_CLASS_ENT(CompileSym2Flags, ManagedPresent),
116     CV_ENUM_CLASS_ENT(CompileSym2Flags, SecurityChecks),
117     CV_ENUM_CLASS_ENT(CompileSym2Flags, HotPatch),
118     CV_ENUM_CLASS_ENT(CompileSym2Flags, CVTCIL),
119     CV_ENUM_CLASS_ENT(CompileSym2Flags, MSILModule),
120 };
121 
122 static const EnumEntry<uint32_t> CompileSym3FlagNames[] = {
123     CV_ENUM_CLASS_ENT(CompileSym3Flags, EC),
124     CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDbgInfo),
125     CV_ENUM_CLASS_ENT(CompileSym3Flags, LTCG),
126     CV_ENUM_CLASS_ENT(CompileSym3Flags, NoDataAlign),
127     CV_ENUM_CLASS_ENT(CompileSym3Flags, ManagedPresent),
128     CV_ENUM_CLASS_ENT(CompileSym3Flags, SecurityChecks),
129     CV_ENUM_CLASS_ENT(CompileSym3Flags, HotPatch),
130     CV_ENUM_CLASS_ENT(CompileSym3Flags, CVTCIL),
131     CV_ENUM_CLASS_ENT(CompileSym3Flags, MSILModule),
132     CV_ENUM_CLASS_ENT(CompileSym3Flags, Sdl),
133     CV_ENUM_CLASS_ENT(CompileSym3Flags, PGO),
134     CV_ENUM_CLASS_ENT(CompileSym3Flags, Exp),
135 };
136 
137 static const EnumEntry<uint32_t> FileChecksumNames[] = {
138     CV_ENUM_CLASS_ENT(FileChecksumKind, None),
139     CV_ENUM_CLASS_ENT(FileChecksumKind, MD5),
140     CV_ENUM_CLASS_ENT(FileChecksumKind, SHA1),
141     CV_ENUM_CLASS_ENT(FileChecksumKind, SHA256),
142 };
143 
144 static const EnumEntry<unsigned> CPUTypeNames[] = {
145     CV_ENUM_CLASS_ENT(CPUType, Intel8080),
146     CV_ENUM_CLASS_ENT(CPUType, Intel8086),
147     CV_ENUM_CLASS_ENT(CPUType, Intel80286),
148     CV_ENUM_CLASS_ENT(CPUType, Intel80386),
149     CV_ENUM_CLASS_ENT(CPUType, Intel80486),
150     CV_ENUM_CLASS_ENT(CPUType, Pentium),
151     CV_ENUM_CLASS_ENT(CPUType, PentiumPro),
152     CV_ENUM_CLASS_ENT(CPUType, Pentium3),
153     CV_ENUM_CLASS_ENT(CPUType, MIPS),
154     CV_ENUM_CLASS_ENT(CPUType, MIPS16),
155     CV_ENUM_CLASS_ENT(CPUType, MIPS32),
156     CV_ENUM_CLASS_ENT(CPUType, MIPS64),
157     CV_ENUM_CLASS_ENT(CPUType, MIPSI),
158     CV_ENUM_CLASS_ENT(CPUType, MIPSII),
159     CV_ENUM_CLASS_ENT(CPUType, MIPSIII),
160     CV_ENUM_CLASS_ENT(CPUType, MIPSIV),
161     CV_ENUM_CLASS_ENT(CPUType, MIPSV),
162     CV_ENUM_CLASS_ENT(CPUType, M68000),
163     CV_ENUM_CLASS_ENT(CPUType, M68010),
164     CV_ENUM_CLASS_ENT(CPUType, M68020),
165     CV_ENUM_CLASS_ENT(CPUType, M68030),
166     CV_ENUM_CLASS_ENT(CPUType, M68040),
167     CV_ENUM_CLASS_ENT(CPUType, Alpha),
168     CV_ENUM_CLASS_ENT(CPUType, Alpha21164),
169     CV_ENUM_CLASS_ENT(CPUType, Alpha21164A),
170     CV_ENUM_CLASS_ENT(CPUType, Alpha21264),
171     CV_ENUM_CLASS_ENT(CPUType, Alpha21364),
172     CV_ENUM_CLASS_ENT(CPUType, PPC601),
173     CV_ENUM_CLASS_ENT(CPUType, PPC603),
174     CV_ENUM_CLASS_ENT(CPUType, PPC604),
175     CV_ENUM_CLASS_ENT(CPUType, PPC620),
176     CV_ENUM_CLASS_ENT(CPUType, PPCFP),
177     CV_ENUM_CLASS_ENT(CPUType, PPCBE),
178     CV_ENUM_CLASS_ENT(CPUType, SH3),
179     CV_ENUM_CLASS_ENT(CPUType, SH3E),
180     CV_ENUM_CLASS_ENT(CPUType, SH3DSP),
181     CV_ENUM_CLASS_ENT(CPUType, SH4),
182     CV_ENUM_CLASS_ENT(CPUType, SHMedia),
183     CV_ENUM_CLASS_ENT(CPUType, ARM3),
184     CV_ENUM_CLASS_ENT(CPUType, ARM4),
185     CV_ENUM_CLASS_ENT(CPUType, ARM4T),
186     CV_ENUM_CLASS_ENT(CPUType, ARM5),
187     CV_ENUM_CLASS_ENT(CPUType, ARM5T),
188     CV_ENUM_CLASS_ENT(CPUType, ARM6),
189     CV_ENUM_CLASS_ENT(CPUType, ARM_XMAC),
190     CV_ENUM_CLASS_ENT(CPUType, ARM_WMMX),
191     CV_ENUM_CLASS_ENT(CPUType, ARM7),
192     CV_ENUM_CLASS_ENT(CPUType, Omni),
193     CV_ENUM_CLASS_ENT(CPUType, Ia64),
194     CV_ENUM_CLASS_ENT(CPUType, Ia64_2),
195     CV_ENUM_CLASS_ENT(CPUType, CEE),
196     CV_ENUM_CLASS_ENT(CPUType, AM33),
197     CV_ENUM_CLASS_ENT(CPUType, M32R),
198     CV_ENUM_CLASS_ENT(CPUType, TriCore),
199     CV_ENUM_CLASS_ENT(CPUType, X64),
200     CV_ENUM_CLASS_ENT(CPUType, EBC),
201     CV_ENUM_CLASS_ENT(CPUType, Thumb),
202     CV_ENUM_CLASS_ENT(CPUType, ARMNT),
203     CV_ENUM_CLASS_ENT(CPUType, ARM64),
204     CV_ENUM_CLASS_ENT(CPUType, HybridX86ARM64),
205     CV_ENUM_CLASS_ENT(CPUType, ARM64EC),
206     CV_ENUM_CLASS_ENT(CPUType, ARM64X),
207     CV_ENUM_CLASS_ENT(CPUType, D3D11_Shader),
208 };
209 
210 static const EnumEntry<uint32_t> FrameProcSymFlagNames[] = {
211     CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasAlloca),
212     CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasSetJmp),
213     CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasLongJmp),
214     CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasInlineAssembly),
215     CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasExceptionHandling),
216     CV_ENUM_CLASS_ENT(FrameProcedureOptions, MarkedInline),
217     CV_ENUM_CLASS_ENT(FrameProcedureOptions, HasStructuredExceptionHandling),
218     CV_ENUM_CLASS_ENT(FrameProcedureOptions, Naked),
219     CV_ENUM_CLASS_ENT(FrameProcedureOptions, SecurityChecks),
220     CV_ENUM_CLASS_ENT(FrameProcedureOptions, AsynchronousExceptionHandling),
221     CV_ENUM_CLASS_ENT(FrameProcedureOptions, NoStackOrderingForSecurityChecks),
222     CV_ENUM_CLASS_ENT(FrameProcedureOptions, Inlined),
223     CV_ENUM_CLASS_ENT(FrameProcedureOptions, StrictSecurityChecks),
224     CV_ENUM_CLASS_ENT(FrameProcedureOptions, SafeBuffers),
225     CV_ENUM_CLASS_ENT(FrameProcedureOptions, EncodedLocalBasePointerMask),
226     CV_ENUM_CLASS_ENT(FrameProcedureOptions, EncodedParamBasePointerMask),
227     CV_ENUM_CLASS_ENT(FrameProcedureOptions, ProfileGuidedOptimization),
228     CV_ENUM_CLASS_ENT(FrameProcedureOptions, ValidProfileCounts),
229     CV_ENUM_CLASS_ENT(FrameProcedureOptions, OptimizedForSpeed),
230     CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfg),
231     CV_ENUM_CLASS_ENT(FrameProcedureOptions, GuardCfw),
232 };
233 
234 static const EnumEntry<uint32_t> ModuleSubstreamKindNames[] = {
235     CV_ENUM_CLASS_ENT(DebugSubsectionKind, None),
236     CV_ENUM_CLASS_ENT(DebugSubsectionKind, Symbols),
237     CV_ENUM_CLASS_ENT(DebugSubsectionKind, Lines),
238     CV_ENUM_CLASS_ENT(DebugSubsectionKind, StringTable),
239     CV_ENUM_CLASS_ENT(DebugSubsectionKind, FileChecksums),
240     CV_ENUM_CLASS_ENT(DebugSubsectionKind, FrameData),
241     CV_ENUM_CLASS_ENT(DebugSubsectionKind, InlineeLines),
242     CV_ENUM_CLASS_ENT(DebugSubsectionKind, CrossScopeImports),
243     CV_ENUM_CLASS_ENT(DebugSubsectionKind, CrossScopeExports),
244     CV_ENUM_CLASS_ENT(DebugSubsectionKind, ILLines),
245     CV_ENUM_CLASS_ENT(DebugSubsectionKind, FuncMDTokenMap),
246     CV_ENUM_CLASS_ENT(DebugSubsectionKind, TypeMDTokenMap),
247     CV_ENUM_CLASS_ENT(DebugSubsectionKind, MergedAssemblyInput),
248     CV_ENUM_CLASS_ENT(DebugSubsectionKind, CoffSymbolRVA),
249 };
250 
251 static const EnumEntry<uint16_t> ExportSymFlagNames[] = {
252     CV_ENUM_CLASS_ENT(ExportFlags, IsConstant),
253     CV_ENUM_CLASS_ENT(ExportFlags, IsData),
254     CV_ENUM_CLASS_ENT(ExportFlags, IsPrivate),
255     CV_ENUM_CLASS_ENT(ExportFlags, HasNoName),
256     CV_ENUM_CLASS_ENT(ExportFlags, HasExplicitOrdinal),
257     CV_ENUM_CLASS_ENT(ExportFlags, IsForwarder),
258 };
259 
260 static const EnumEntry<uint8_t> ThunkOrdinalNames[] = {
261     CV_ENUM_CLASS_ENT(ThunkOrdinal, Standard),
262     CV_ENUM_CLASS_ENT(ThunkOrdinal, ThisAdjustor),
263     CV_ENUM_CLASS_ENT(ThunkOrdinal, Vcall),
264     CV_ENUM_CLASS_ENT(ThunkOrdinal, Pcode),
265     CV_ENUM_CLASS_ENT(ThunkOrdinal, UnknownLoad),
266     CV_ENUM_CLASS_ENT(ThunkOrdinal, TrampIncremental),
267     CV_ENUM_CLASS_ENT(ThunkOrdinal, BranchIsland),
268 };
269 
270 static const EnumEntry<uint16_t> TrampolineNames[] = {
271     CV_ENUM_CLASS_ENT(TrampolineType, TrampIncremental),
272     CV_ENUM_CLASS_ENT(TrampolineType, BranchIsland),
273 };
274 
275 static const EnumEntry<COFF::SectionCharacteristics>
276     ImageSectionCharacteristicNames[] = {
277         CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NOLOAD),
278         CV_ENUM_ENT(COFF, IMAGE_SCN_TYPE_NO_PAD),
279         CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_CODE),
280         CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_INITIALIZED_DATA),
281         CV_ENUM_ENT(COFF, IMAGE_SCN_CNT_UNINITIALIZED_DATA),
282         CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_OTHER),
283         CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_INFO),
284         CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_REMOVE),
285         CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_COMDAT),
286         CV_ENUM_ENT(COFF, IMAGE_SCN_GPREL),
287         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PURGEABLE),
288         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_16BIT),
289         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_LOCKED),
290         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_PRELOAD),
291         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1BYTES),
292         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2BYTES),
293         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4BYTES),
294         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8BYTES),
295         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_16BYTES),
296         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_32BYTES),
297         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_64BYTES),
298         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_128BYTES),
299         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_256BYTES),
300         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_512BYTES),
301         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_1024BYTES),
302         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_2048BYTES),
303         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_4096BYTES),
304         CV_ENUM_ENT(COFF, IMAGE_SCN_ALIGN_8192BYTES),
305         CV_ENUM_ENT(COFF, IMAGE_SCN_LNK_NRELOC_OVFL),
306         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_DISCARDABLE),
307         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_CACHED),
308         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_NOT_PAGED),
309         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_SHARED),
310         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_EXECUTE),
311         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_READ),
312         CV_ENUM_ENT(COFF, IMAGE_SCN_MEM_WRITE)};
313 
314 static const EnumEntry<uint16_t> ClassOptionNames[] = {
315     CV_ENUM_CLASS_ENT(ClassOptions, Packed),
316     CV_ENUM_CLASS_ENT(ClassOptions, HasConstructorOrDestructor),
317     CV_ENUM_CLASS_ENT(ClassOptions, HasOverloadedOperator),
318     CV_ENUM_CLASS_ENT(ClassOptions, Nested),
319     CV_ENUM_CLASS_ENT(ClassOptions, ContainsNestedClass),
320     CV_ENUM_CLASS_ENT(ClassOptions, HasOverloadedAssignmentOperator),
321     CV_ENUM_CLASS_ENT(ClassOptions, HasConversionOperator),
322     CV_ENUM_CLASS_ENT(ClassOptions, ForwardReference),
323     CV_ENUM_CLASS_ENT(ClassOptions, Scoped),
324     CV_ENUM_CLASS_ENT(ClassOptions, HasUniqueName),
325     CV_ENUM_CLASS_ENT(ClassOptions, Sealed),
326     CV_ENUM_CLASS_ENT(ClassOptions, Intrinsic),
327 };
328 
329 static const EnumEntry<uint8_t> MemberAccessNames[] = {
330     CV_ENUM_CLASS_ENT(MemberAccess, None),
331     CV_ENUM_CLASS_ENT(MemberAccess, Private),
332     CV_ENUM_CLASS_ENT(MemberAccess, Protected),
333     CV_ENUM_CLASS_ENT(MemberAccess, Public),
334 };
335 
336 static const EnumEntry<uint16_t> MethodOptionNames[] = {
337     CV_ENUM_CLASS_ENT(MethodOptions, Pseudo),
338     CV_ENUM_CLASS_ENT(MethodOptions, NoInherit),
339     CV_ENUM_CLASS_ENT(MethodOptions, NoConstruct),
340     CV_ENUM_CLASS_ENT(MethodOptions, CompilerGenerated),
341     CV_ENUM_CLASS_ENT(MethodOptions, Sealed),
342 };
343 
344 static const EnumEntry<uint16_t> MemberKindNames[] = {
345     CV_ENUM_CLASS_ENT(MethodKind, Vanilla),
346     CV_ENUM_CLASS_ENT(MethodKind, Virtual),
347     CV_ENUM_CLASS_ENT(MethodKind, Static),
348     CV_ENUM_CLASS_ENT(MethodKind, Friend),
349     CV_ENUM_CLASS_ENT(MethodKind, IntroducingVirtual),
350     CV_ENUM_CLASS_ENT(MethodKind, PureVirtual),
351     CV_ENUM_CLASS_ENT(MethodKind, PureIntroducingVirtual),
352 };
353 
354 static const EnumEntry<uint8_t> PtrKindNames[] = {
355     CV_ENUM_CLASS_ENT(PointerKind, Near16),
356     CV_ENUM_CLASS_ENT(PointerKind, Far16),
357     CV_ENUM_CLASS_ENT(PointerKind, Huge16),
358     CV_ENUM_CLASS_ENT(PointerKind, BasedOnSegment),
359     CV_ENUM_CLASS_ENT(PointerKind, BasedOnValue),
360     CV_ENUM_CLASS_ENT(PointerKind, BasedOnSegmentValue),
361     CV_ENUM_CLASS_ENT(PointerKind, BasedOnAddress),
362     CV_ENUM_CLASS_ENT(PointerKind, BasedOnSegmentAddress),
363     CV_ENUM_CLASS_ENT(PointerKind, BasedOnType),
364     CV_ENUM_CLASS_ENT(PointerKind, BasedOnSelf),
365     CV_ENUM_CLASS_ENT(PointerKind, Near32),
366     CV_ENUM_CLASS_ENT(PointerKind, Far32),
367     CV_ENUM_CLASS_ENT(PointerKind, Near64),
368 };
369 
370 static const EnumEntry<uint8_t> PtrModeNames[] = {
371     CV_ENUM_CLASS_ENT(PointerMode, Pointer),
372     CV_ENUM_CLASS_ENT(PointerMode, LValueReference),
373     CV_ENUM_CLASS_ENT(PointerMode, PointerToDataMember),
374     CV_ENUM_CLASS_ENT(PointerMode, PointerToMemberFunction),
375     CV_ENUM_CLASS_ENT(PointerMode, RValueReference),
376 };
377 
378 static const EnumEntry<uint16_t> PtrMemberRepNames[] = {
379     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, Unknown),
380     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, SingleInheritanceData),
381     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, MultipleInheritanceData),
382     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, VirtualInheritanceData),
383     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, GeneralData),
384     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, SingleInheritanceFunction),
385     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation,
386                       MultipleInheritanceFunction),
387     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation,
388                       VirtualInheritanceFunction),
389     CV_ENUM_CLASS_ENT(PointerToMemberRepresentation, GeneralFunction),
390 };
391 
392 static const EnumEntry<uint16_t> TypeModifierNames[] = {
393     CV_ENUM_CLASS_ENT(ModifierOptions, Const),
394     CV_ENUM_CLASS_ENT(ModifierOptions, Volatile),
395     CV_ENUM_CLASS_ENT(ModifierOptions, Unaligned),
396 };
397 
398 static const EnumEntry<uint8_t> CallingConventions[] = {
399     CV_ENUM_CLASS_ENT(CallingConvention, NearC),
400     CV_ENUM_CLASS_ENT(CallingConvention, FarC),
401     CV_ENUM_CLASS_ENT(CallingConvention, NearPascal),
402     CV_ENUM_CLASS_ENT(CallingConvention, FarPascal),
403     CV_ENUM_CLASS_ENT(CallingConvention, NearFast),
404     CV_ENUM_CLASS_ENT(CallingConvention, FarFast),
405     CV_ENUM_CLASS_ENT(CallingConvention, NearStdCall),
406     CV_ENUM_CLASS_ENT(CallingConvention, FarStdCall),
407     CV_ENUM_CLASS_ENT(CallingConvention, NearSysCall),
408     CV_ENUM_CLASS_ENT(CallingConvention, FarSysCall),
409     CV_ENUM_CLASS_ENT(CallingConvention, ThisCall),
410     CV_ENUM_CLASS_ENT(CallingConvention, MipsCall),
411     CV_ENUM_CLASS_ENT(CallingConvention, Generic),
412     CV_ENUM_CLASS_ENT(CallingConvention, AlphaCall),
413     CV_ENUM_CLASS_ENT(CallingConvention, PpcCall),
414     CV_ENUM_CLASS_ENT(CallingConvention, SHCall),
415     CV_ENUM_CLASS_ENT(CallingConvention, ArmCall),
416     CV_ENUM_CLASS_ENT(CallingConvention, AM33Call),
417     CV_ENUM_CLASS_ENT(CallingConvention, TriCall),
418     CV_ENUM_CLASS_ENT(CallingConvention, SH5Call),
419     CV_ENUM_CLASS_ENT(CallingConvention, M32RCall),
420     CV_ENUM_CLASS_ENT(CallingConvention, ClrCall),
421     CV_ENUM_CLASS_ENT(CallingConvention, Inline),
422     CV_ENUM_CLASS_ENT(CallingConvention, NearVector),
423 };
424 
425 static const EnumEntry<uint8_t> FunctionOptionEnum[] = {
426     CV_ENUM_CLASS_ENT(FunctionOptions, CxxReturnUdt),
427     CV_ENUM_CLASS_ENT(FunctionOptions, Constructor),
428     CV_ENUM_CLASS_ENT(FunctionOptions, ConstructorWithVirtualBases),
429 };
430 
431 static const EnumEntry<uint16_t> LabelTypeEnum[] = {
432     CV_ENUM_CLASS_ENT(LabelType, Near),
433     CV_ENUM_CLASS_ENT(LabelType, Far),
434 };
435 
436 namespace llvm {
437 namespace codeview {
438 
439 ArrayRef<EnumEntry<SymbolKind>> getSymbolTypeNames() {
440   return makeArrayRef(SymbolTypeNames);
441 }
442 
443 ArrayRef<EnumEntry<TypeLeafKind>> getTypeLeafNames() {
444   return makeArrayRef(TypeLeafNames);
445 }
446 
447 ArrayRef<EnumEntry<uint16_t>> getRegisterNames(CPUType Cpu) {
448   if (Cpu == CPUType::ARMNT) {
449     return makeArrayRef(RegisterNames_ARM);
450   } else if (Cpu == CPUType::ARM64) {
451     return makeArrayRef(RegisterNames_ARM64);
452   }
453   return makeArrayRef(RegisterNames_X86);
454 }
455 
456 ArrayRef<EnumEntry<uint32_t>> getPublicSymFlagNames() {
457   return makeArrayRef(PublicSymFlagNames);
458 }
459 
460 ArrayRef<EnumEntry<uint8_t>> getProcSymFlagNames() {
461   return makeArrayRef(ProcSymFlagNames);
462 }
463 
464 ArrayRef<EnumEntry<uint16_t>> getLocalFlagNames() {
465   return makeArrayRef(LocalFlags);
466 }
467 
468 ArrayRef<EnumEntry<uint8_t>> getFrameCookieKindNames() {
469   return makeArrayRef(FrameCookieKinds);
470 }
471 
472 ArrayRef<EnumEntry<SourceLanguage>> getSourceLanguageNames() {
473   return makeArrayRef(SourceLanguages);
474 }
475 
476 ArrayRef<EnumEntry<uint32_t>> getCompileSym2FlagNames() {
477   return makeArrayRef(CompileSym2FlagNames);
478 }
479 
480 ArrayRef<EnumEntry<uint32_t>> getCompileSym3FlagNames() {
481   return makeArrayRef(CompileSym3FlagNames);
482 }
483 
484 ArrayRef<EnumEntry<uint32_t>> getFileChecksumNames() {
485   return makeArrayRef(FileChecksumNames);
486 }
487 
488 ArrayRef<EnumEntry<unsigned>> getCPUTypeNames() {
489   return makeArrayRef(CPUTypeNames);
490 }
491 
492 ArrayRef<EnumEntry<uint32_t>> getFrameProcSymFlagNames() {
493   return makeArrayRef(FrameProcSymFlagNames);
494 }
495 
496 ArrayRef<EnumEntry<uint16_t>> getExportSymFlagNames() {
497   return makeArrayRef(ExportSymFlagNames);
498 }
499 
500 ArrayRef<EnumEntry<uint32_t>> getModuleSubstreamKindNames() {
501   return makeArrayRef(ModuleSubstreamKindNames);
502 }
503 
504 ArrayRef<EnumEntry<uint8_t>> getThunkOrdinalNames() {
505   return makeArrayRef(ThunkOrdinalNames);
506 }
507 
508 ArrayRef<EnumEntry<uint16_t>> getTrampolineNames() {
509   return makeArrayRef(TrampolineNames);
510 }
511 
512 ArrayRef<EnumEntry<COFF::SectionCharacteristics>>
513 getImageSectionCharacteristicNames() {
514   return makeArrayRef(ImageSectionCharacteristicNames);
515 }
516 
517 ArrayRef<EnumEntry<uint16_t>> getClassOptionNames() {
518   return makeArrayRef(ClassOptionNames);
519 }
520 
521 ArrayRef<EnumEntry<uint8_t>> getMemberAccessNames() {
522   return makeArrayRef(MemberAccessNames);
523 }
524 
525 ArrayRef<EnumEntry<uint16_t>> getMethodOptionNames() {
526   return makeArrayRef(MethodOptionNames);
527 }
528 
529 ArrayRef<EnumEntry<uint16_t>> getMemberKindNames() {
530   return makeArrayRef(MemberKindNames);
531 }
532 
533 ArrayRef<EnumEntry<uint8_t>> getPtrKindNames() {
534   return makeArrayRef(PtrKindNames);
535 }
536 
537 ArrayRef<EnumEntry<uint8_t>> getPtrModeNames() {
538   return makeArrayRef(PtrModeNames);
539 }
540 
541 ArrayRef<EnumEntry<uint16_t>> getPtrMemberRepNames() {
542   return makeArrayRef(PtrMemberRepNames);
543 }
544 
545 ArrayRef<EnumEntry<uint16_t>> getTypeModifierNames() {
546   return makeArrayRef(TypeModifierNames);
547 }
548 
549 ArrayRef<EnumEntry<uint8_t>> getCallingConventions() {
550   return makeArrayRef(CallingConventions);
551 }
552 
553 ArrayRef<EnumEntry<uint8_t>> getFunctionOptionEnum() {
554   return makeArrayRef(FunctionOptionEnum);
555 }
556 
557 ArrayRef<EnumEntry<uint16_t>> getLabelTypeEnum() {
558   return makeArrayRef(LabelTypeEnum);
559 }
560 
561 } // end namespace codeview
562 } // end namespace llvm
563