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