xref: /freebsd/contrib/llvm-project/clang/utils/TableGen/TableGen.cpp (revision 5b56413d04e608379c9a306373554a8e4d321bc0)
1 //===- TableGen.cpp - Top-Level TableGen implementation for Clang ---------===//
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 // This file contains the main function for Clang's TableGen.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "TableGenBackends.h" // Declares all backends.
14 #include "ASTTableGen.h"
15 #include "llvm/Support/CommandLine.h"
16 #include "llvm/Support/ManagedStatic.h"
17 #include "llvm/Support/PrettyStackTrace.h"
18 #include "llvm/Support/Signals.h"
19 #include "llvm/TableGen/Error.h"
20 #include "llvm/TableGen/Main.h"
21 #include "llvm/TableGen/Record.h"
22 
23 using namespace llvm;
24 using namespace clang;
25 
26 enum ActionType {
27   PrintRecords,
28   DumpJSON,
29   GenClangAttrClasses,
30   GenClangAttrParserStringSwitches,
31   GenClangAttrSubjectMatchRulesParserStringSwitches,
32   GenClangAttrImpl,
33   GenClangAttrList,
34   GenClangAttrCanPrintLeftList,
35   GenClangAttrMustPrintLeftList,
36   GenClangAttrDocTable,
37   GenClangAttrSubjectMatchRuleList,
38   GenClangAttrPCHRead,
39   GenClangAttrPCHWrite,
40   GenClangRegularKeywordAttributeInfo,
41   GenClangAttrHasAttributeImpl,
42   GenClangAttrSpellingListIndex,
43   GenClangAttrASTVisitor,
44   GenClangAttrTemplateInstantiate,
45   GenClangAttrParsedAttrList,
46   GenClangAttrParsedAttrImpl,
47   GenClangAttrParsedAttrKinds,
48   GenClangAttrTextNodeDump,
49   GenClangAttrNodeTraverse,
50   GenClangBasicReader,
51   GenClangBasicWriter,
52   GenClangDiagsDefs,
53   GenClangDiagGroups,
54   GenClangDiagsIndexName,
55   GenClangCommentNodes,
56   GenClangDeclNodes,
57   GenClangStmtNodes,
58   GenClangTypeNodes,
59   GenClangTypeReader,
60   GenClangTypeWriter,
61   GenClangOpcodes,
62   GenClangSACheckers,
63   GenClangSyntaxNodeList,
64   GenClangSyntaxNodeClasses,
65   GenClangCommentHTMLTags,
66   GenClangCommentHTMLTagsProperties,
67   GenClangCommentHTMLNamedCharacterReferences,
68   GenClangCommentCommandInfo,
69   GenClangCommentCommandList,
70   GenClangOpenCLBuiltins,
71   GenClangOpenCLBuiltinHeader,
72   GenClangOpenCLBuiltinTests,
73   GenArmNeon,
74   GenArmFP16,
75   GenArmBF16,
76   GenArmVectorType,
77   GenArmNeonSema,
78   GenArmNeonTest,
79   GenArmMveHeader,
80   GenArmMveBuiltinDef,
81   GenArmMveBuiltinSema,
82   GenArmMveBuiltinCG,
83   GenArmMveBuiltinAliases,
84   GenArmSveHeader,
85   GenArmSveBuiltins,
86   GenArmSveBuiltinCG,
87   GenArmSveTypeFlags,
88   GenArmSveRangeChecks,
89   GenArmSveStreamingAttrs,
90   GenArmSmeHeader,
91   GenArmSmeBuiltins,
92   GenArmSmeBuiltinCG,
93   GenArmSmeRangeChecks,
94   GenArmSmeStreamingAttrs,
95   GenArmSmeBuiltinZAState,
96   GenArmCdeHeader,
97   GenArmCdeBuiltinDef,
98   GenArmCdeBuiltinSema,
99   GenArmCdeBuiltinCG,
100   GenArmCdeBuiltinAliases,
101   GenRISCVVectorHeader,
102   GenRISCVVectorBuiltins,
103   GenRISCVVectorBuiltinCG,
104   GenRISCVVectorBuiltinSema,
105   GenRISCVSiFiveVectorBuiltins,
106   GenRISCVSiFiveVectorBuiltinCG,
107   GenRISCVSiFiveVectorBuiltinSema,
108   GenAttrDocs,
109   GenDiagDocs,
110   GenOptDocs,
111   GenDataCollectors,
112   GenTestPragmaAttributeSupportedAttributes
113 };
114 
115 namespace {
116 cl::opt<ActionType> Action(
117     cl::desc("Action to perform:"),
118     cl::values(
119         clEnumValN(PrintRecords, "print-records",
120                    "Print all records to stdout (default)"),
121         clEnumValN(DumpJSON, "dump-json",
122                    "Dump all records as machine-readable JSON"),
123         clEnumValN(GenClangAttrClasses, "gen-clang-attr-classes",
124                    "Generate clang attribute clases"),
125         clEnumValN(GenClangAttrParserStringSwitches,
126                    "gen-clang-attr-parser-string-switches",
127                    "Generate all parser-related attribute string switches"),
128         clEnumValN(GenClangAttrSubjectMatchRulesParserStringSwitches,
129                    "gen-clang-attr-subject-match-rules-parser-string-switches",
130                    "Generate all parser-related attribute subject match rule"
131                    "string switches"),
132         clEnumValN(GenClangAttrImpl, "gen-clang-attr-impl",
133                    "Generate clang attribute implementations"),
134         clEnumValN(GenClangAttrList, "gen-clang-attr-list",
135                    "Generate a clang attribute list"),
136         clEnumValN(GenClangAttrCanPrintLeftList,
137                    "gen-clang-attr-can-print-left-list",
138                    "Generate list of attributes that can be printed on left "
139                    "side of a decl"),
140         clEnumValN(GenClangAttrMustPrintLeftList,
141                    "gen-clang-attr-must-print-left-list",
142                    "Generate list of attributes that must be printed on left "
143                    "side of a decl"),
144         clEnumValN(GenClangAttrDocTable, "gen-clang-attr-doc-table",
145                    "Generate a table of attribute documentation"),
146         clEnumValN(GenClangAttrSubjectMatchRuleList,
147                    "gen-clang-attr-subject-match-rule-list",
148                    "Generate a clang attribute subject match rule list"),
149         clEnumValN(GenClangAttrPCHRead, "gen-clang-attr-pch-read",
150                    "Generate clang PCH attribute reader"),
151         clEnumValN(GenClangAttrPCHWrite, "gen-clang-attr-pch-write",
152                    "Generate clang PCH attribute writer"),
153         clEnumValN(GenClangRegularKeywordAttributeInfo,
154                    "gen-clang-regular-keyword-attr-info",
155                    "Generate a list of regular keyword attributes with info "
156                    "about their arguments"),
157         clEnumValN(GenClangAttrHasAttributeImpl,
158                    "gen-clang-attr-has-attribute-impl",
159                    "Generate a clang attribute spelling list"),
160         clEnumValN(GenClangAttrSpellingListIndex,
161                    "gen-clang-attr-spelling-index",
162                    "Generate a clang attribute spelling index"),
163         clEnumValN(GenClangAttrASTVisitor, "gen-clang-attr-ast-visitor",
164                    "Generate a recursive AST visitor for clang attributes"),
165         clEnumValN(GenClangAttrTemplateInstantiate,
166                    "gen-clang-attr-template-instantiate",
167                    "Generate a clang template instantiate code"),
168         clEnumValN(GenClangAttrParsedAttrList,
169                    "gen-clang-attr-parsed-attr-list",
170                    "Generate a clang parsed attribute list"),
171         clEnumValN(GenClangAttrParsedAttrImpl,
172                    "gen-clang-attr-parsed-attr-impl",
173                    "Generate the clang parsed attribute helpers"),
174         clEnumValN(GenClangAttrParsedAttrKinds,
175                    "gen-clang-attr-parsed-attr-kinds",
176                    "Generate a clang parsed attribute kinds"),
177         clEnumValN(GenClangAttrTextNodeDump, "gen-clang-attr-text-node-dump",
178                    "Generate clang attribute text node dumper"),
179         clEnumValN(GenClangAttrNodeTraverse, "gen-clang-attr-node-traverse",
180                    "Generate clang attribute traverser"),
181         clEnumValN(GenClangDiagsDefs, "gen-clang-diags-defs",
182                    "Generate Clang diagnostics definitions"),
183         clEnumValN(GenClangDiagGroups, "gen-clang-diag-groups",
184                    "Generate Clang diagnostic groups"),
185         clEnumValN(GenClangDiagsIndexName, "gen-clang-diags-index-name",
186                    "Generate Clang diagnostic name index"),
187         clEnumValN(GenClangBasicReader, "gen-clang-basic-reader",
188                    "Generate Clang BasicReader classes"),
189         clEnumValN(GenClangBasicWriter, "gen-clang-basic-writer",
190                    "Generate Clang BasicWriter classes"),
191         clEnumValN(GenClangCommentNodes, "gen-clang-comment-nodes",
192                    "Generate Clang AST comment nodes"),
193         clEnumValN(GenClangDeclNodes, "gen-clang-decl-nodes",
194                    "Generate Clang AST declaration nodes"),
195         clEnumValN(GenClangStmtNodes, "gen-clang-stmt-nodes",
196                    "Generate Clang AST statement nodes"),
197         clEnumValN(GenClangTypeNodes, "gen-clang-type-nodes",
198                    "Generate Clang AST type nodes"),
199         clEnumValN(GenClangTypeReader, "gen-clang-type-reader",
200                    "Generate Clang AbstractTypeReader class"),
201         clEnumValN(GenClangTypeWriter, "gen-clang-type-writer",
202                    "Generate Clang AbstractTypeWriter class"),
203         clEnumValN(GenClangOpcodes, "gen-clang-opcodes",
204                    "Generate Clang constexpr interpreter opcodes"),
205         clEnumValN(GenClangSACheckers, "gen-clang-sa-checkers",
206                    "Generate Clang Static Analyzer checkers"),
207         clEnumValN(GenClangSyntaxNodeList, "gen-clang-syntax-node-list",
208                    "Generate list of Clang Syntax Tree node types"),
209         clEnumValN(GenClangSyntaxNodeClasses, "gen-clang-syntax-node-classes",
210                    "Generate definitions of Clang Syntax Tree node clasess"),
211         clEnumValN(GenClangCommentHTMLTags, "gen-clang-comment-html-tags",
212                    "Generate efficient matchers for HTML tag "
213                    "names that are used in documentation comments"),
214         clEnumValN(GenClangCommentHTMLTagsProperties,
215                    "gen-clang-comment-html-tags-properties",
216                    "Generate efficient matchers for HTML tag "
217                    "properties"),
218         clEnumValN(GenClangCommentHTMLNamedCharacterReferences,
219                    "gen-clang-comment-html-named-character-references",
220                    "Generate function to translate named character "
221                    "references to UTF-8 sequences"),
222         clEnumValN(GenClangCommentCommandInfo, "gen-clang-comment-command-info",
223                    "Generate command properties for commands that "
224                    "are used in documentation comments"),
225         clEnumValN(GenClangCommentCommandList, "gen-clang-comment-command-list",
226                    "Generate list of commands that are used in "
227                    "documentation comments"),
228         clEnumValN(GenClangOpenCLBuiltins, "gen-clang-opencl-builtins",
229                    "Generate OpenCL builtin declaration handlers"),
230         clEnumValN(GenClangOpenCLBuiltinHeader,
231                    "gen-clang-opencl-builtin-header",
232                    "Generate OpenCL builtin header"),
233         clEnumValN(GenClangOpenCLBuiltinTests, "gen-clang-opencl-builtin-tests",
234                    "Generate OpenCL builtin declaration tests"),
235         clEnumValN(GenArmNeon, "gen-arm-neon", "Generate arm_neon.h for clang"),
236         clEnumValN(GenArmFP16, "gen-arm-fp16", "Generate arm_fp16.h for clang"),
237         clEnumValN(GenArmBF16, "gen-arm-bf16", "Generate arm_bf16.h for clang"),
238         clEnumValN(GenArmVectorType, "gen-arm-vector-type",
239                    "Generate arm_vector_types.h for clang"),
240         clEnumValN(GenArmNeonSema, "gen-arm-neon-sema",
241                    "Generate ARM NEON sema support for clang"),
242         clEnumValN(GenArmNeonTest, "gen-arm-neon-test",
243                    "Generate ARM NEON tests for clang"),
244         clEnumValN(GenArmSveHeader, "gen-arm-sve-header",
245                    "Generate arm_sve.h for clang"),
246         clEnumValN(GenArmSveBuiltins, "gen-arm-sve-builtins",
247                    "Generate arm_sve_builtins.inc for clang"),
248         clEnumValN(GenArmSveBuiltinCG, "gen-arm-sve-builtin-codegen",
249                    "Generate arm_sve_builtin_cg_map.inc for clang"),
250         clEnumValN(GenArmSveTypeFlags, "gen-arm-sve-typeflags",
251                    "Generate arm_sve_typeflags.inc for clang"),
252         clEnumValN(GenArmSveRangeChecks, "gen-arm-sve-sema-rangechecks",
253                    "Generate arm_sve_sema_rangechecks.inc for clang"),
254         clEnumValN(GenArmSveStreamingAttrs, "gen-arm-sve-streaming-attrs",
255                    "Generate arm_sve_streaming_attrs.inc for clang"),
256         clEnumValN(GenArmSmeHeader, "gen-arm-sme-header",
257                    "Generate arm_sme.h for clang"),
258         clEnumValN(GenArmSmeBuiltins, "gen-arm-sme-builtins",
259                    "Generate arm_sme_builtins.inc for clang"),
260         clEnumValN(GenArmSmeBuiltinCG, "gen-arm-sme-builtin-codegen",
261                    "Generate arm_sme_builtin_cg_map.inc for clang"),
262         clEnumValN(GenArmSmeRangeChecks, "gen-arm-sme-sema-rangechecks",
263                    "Generate arm_sme_sema_rangechecks.inc for clang"),
264         clEnumValN(GenArmSmeStreamingAttrs, "gen-arm-sme-streaming-attrs",
265                    "Generate arm_sme_streaming_attrs.inc for clang"),
266         clEnumValN(GenArmSmeBuiltinZAState, "gen-arm-sme-builtin-za-state",
267                    "Generate arm_sme_builtins_za_state.inc for clang"),
268         clEnumValN(GenArmMveHeader, "gen-arm-mve-header",
269                    "Generate arm_mve.h for clang"),
270         clEnumValN(GenArmMveBuiltinDef, "gen-arm-mve-builtin-def",
271                    "Generate ARM MVE builtin definitions for clang"),
272         clEnumValN(GenArmMveBuiltinSema, "gen-arm-mve-builtin-sema",
273                    "Generate ARM MVE builtin sema checks for clang"),
274         clEnumValN(GenArmMveBuiltinCG, "gen-arm-mve-builtin-codegen",
275                    "Generate ARM MVE builtin code-generator for clang"),
276         clEnumValN(GenArmMveBuiltinAliases, "gen-arm-mve-builtin-aliases",
277                    "Generate list of valid ARM MVE builtin aliases for clang"),
278         clEnumValN(GenArmCdeHeader, "gen-arm-cde-header",
279                    "Generate arm_cde.h for clang"),
280         clEnumValN(GenArmCdeBuiltinDef, "gen-arm-cde-builtin-def",
281                    "Generate ARM CDE builtin definitions for clang"),
282         clEnumValN(GenArmCdeBuiltinSema, "gen-arm-cde-builtin-sema",
283                    "Generate ARM CDE builtin sema checks for clang"),
284         clEnumValN(GenArmCdeBuiltinCG, "gen-arm-cde-builtin-codegen",
285                    "Generate ARM CDE builtin code-generator for clang"),
286         clEnumValN(GenArmCdeBuiltinAliases, "gen-arm-cde-builtin-aliases",
287                    "Generate list of valid ARM CDE builtin aliases for clang"),
288         clEnumValN(GenRISCVVectorHeader, "gen-riscv-vector-header",
289                    "Generate riscv_vector.h for clang"),
290         clEnumValN(GenRISCVVectorBuiltins, "gen-riscv-vector-builtins",
291                    "Generate riscv_vector_builtins.inc for clang"),
292         clEnumValN(GenRISCVVectorBuiltinCG, "gen-riscv-vector-builtin-codegen",
293                    "Generate riscv_vector_builtin_cg.inc for clang"),
294         clEnumValN(GenRISCVVectorBuiltinSema, "gen-riscv-vector-builtin-sema",
295                    "Generate riscv_vector_builtin_sema.inc for clang"),
296         clEnumValN(GenRISCVSiFiveVectorBuiltins,
297                    "gen-riscv-sifive-vector-builtins",
298                    "Generate riscv_sifive_vector_builtins.inc for clang"),
299         clEnumValN(GenRISCVSiFiveVectorBuiltinCG,
300                    "gen-riscv-sifive-vector-builtin-codegen",
301                    "Generate riscv_sifive_vector_builtin_cg.inc for clang"),
302         clEnumValN(GenRISCVSiFiveVectorBuiltinSema,
303                    "gen-riscv-sifive-vector-builtin-sema",
304                    "Generate riscv_sifive_vector_builtin_sema.inc for clang"),
305         clEnumValN(GenAttrDocs, "gen-attr-docs",
306                    "Generate attribute documentation"),
307         clEnumValN(GenDiagDocs, "gen-diag-docs",
308                    "Generate diagnostic documentation"),
309         clEnumValN(GenOptDocs, "gen-opt-docs", "Generate option documentation"),
310         clEnumValN(GenDataCollectors, "gen-clang-data-collectors",
311                    "Generate data collectors for AST nodes"),
312         clEnumValN(GenTestPragmaAttributeSupportedAttributes,
313                    "gen-clang-test-pragma-attribute-supported-attributes",
314                    "Generate a list of attributes supported by #pragma clang "
315                    "attribute for testing purposes")));
316 
317 cl::opt<std::string>
318 ClangComponent("clang-component",
319                cl::desc("Only use warnings from specified component"),
320                cl::value_desc("component"), cl::Hidden);
321 
322 bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) {
323   switch (Action) {
324   case PrintRecords:
325     OS << Records;           // No argument, dump all contents
326     break;
327   case DumpJSON:
328     EmitJSON(Records, OS);
329     break;
330   case GenClangAttrClasses:
331     EmitClangAttrClass(Records, OS);
332     break;
333   case GenClangAttrParserStringSwitches:
334     EmitClangAttrParserStringSwitches(Records, OS);
335     break;
336   case GenClangAttrSubjectMatchRulesParserStringSwitches:
337     EmitClangAttrSubjectMatchRulesParserStringSwitches(Records, OS);
338     break;
339   case GenClangAttrImpl:
340     EmitClangAttrImpl(Records, OS);
341     break;
342   case GenClangAttrList:
343     EmitClangAttrList(Records, OS);
344     break;
345   case GenClangAttrCanPrintLeftList:
346     EmitClangAttrPrintList("CanPrintOnLeft", Records, OS);
347     break;
348   case GenClangAttrMustPrintLeftList:
349     EmitClangAttrPrintList("PrintOnLeft", Records, OS);
350     break;
351   case GenClangAttrDocTable:
352     EmitClangAttrDocTable(Records, OS);
353     break;
354   case GenClangAttrSubjectMatchRuleList:
355     EmitClangAttrSubjectMatchRuleList(Records, OS);
356     break;
357   case GenClangAttrPCHRead:
358     EmitClangAttrPCHRead(Records, OS);
359     break;
360   case GenClangAttrPCHWrite:
361     EmitClangAttrPCHWrite(Records, OS);
362     break;
363   case GenClangRegularKeywordAttributeInfo:
364     EmitClangRegularKeywordAttributeInfo(Records, OS);
365     break;
366   case GenClangAttrHasAttributeImpl:
367     EmitClangAttrHasAttrImpl(Records, OS);
368     break;
369   case GenClangAttrSpellingListIndex:
370     EmitClangAttrSpellingListIndex(Records, OS);
371     break;
372   case GenClangAttrASTVisitor:
373     EmitClangAttrASTVisitor(Records, OS);
374     break;
375   case GenClangAttrTemplateInstantiate:
376     EmitClangAttrTemplateInstantiate(Records, OS);
377     break;
378   case GenClangAttrParsedAttrList:
379     EmitClangAttrParsedAttrList(Records, OS);
380     break;
381   case GenClangAttrParsedAttrImpl:
382     EmitClangAttrParsedAttrImpl(Records, OS);
383     break;
384   case GenClangAttrParsedAttrKinds:
385     EmitClangAttrParsedAttrKinds(Records, OS);
386     break;
387   case GenClangAttrTextNodeDump:
388     EmitClangAttrTextNodeDump(Records, OS);
389     break;
390   case GenClangAttrNodeTraverse:
391     EmitClangAttrNodeTraverse(Records, OS);
392     break;
393   case GenClangDiagsDefs:
394     EmitClangDiagsDefs(Records, OS, ClangComponent);
395     break;
396   case GenClangDiagGroups:
397     EmitClangDiagGroups(Records, OS);
398     break;
399   case GenClangDiagsIndexName:
400     EmitClangDiagsIndexName(Records, OS);
401     break;
402   case GenClangCommentNodes:
403     EmitClangASTNodes(Records, OS, CommentNodeClassName, "");
404     break;
405   case GenClangDeclNodes:
406     EmitClangASTNodes(Records, OS, DeclNodeClassName, "Decl",
407                       DeclContextNodeClassName);
408     EmitClangDeclContext(Records, OS);
409     break;
410   case GenClangStmtNodes:
411     EmitClangASTNodes(Records, OS, StmtNodeClassName, "");
412     break;
413   case GenClangTypeNodes:
414     EmitClangTypeNodes(Records, OS);
415     break;
416   case GenClangTypeReader:
417     EmitClangTypeReader(Records, OS);
418     break;
419   case GenClangTypeWriter:
420     EmitClangTypeWriter(Records, OS);
421     break;
422   case GenClangBasicReader:
423     EmitClangBasicReader(Records, OS);
424     break;
425   case GenClangBasicWriter:
426     EmitClangBasicWriter(Records, OS);
427     break;
428   case GenClangOpcodes:
429     EmitClangOpcodes(Records, OS);
430     break;
431   case GenClangSACheckers:
432     EmitClangSACheckers(Records, OS);
433     break;
434   case GenClangCommentHTMLTags:
435     EmitClangCommentHTMLTags(Records, OS);
436     break;
437   case GenClangCommentHTMLTagsProperties:
438     EmitClangCommentHTMLTagsProperties(Records, OS);
439     break;
440   case GenClangCommentHTMLNamedCharacterReferences:
441     EmitClangCommentHTMLNamedCharacterReferences(Records, OS);
442     break;
443   case GenClangCommentCommandInfo:
444     EmitClangCommentCommandInfo(Records, OS);
445     break;
446   case GenClangCommentCommandList:
447     EmitClangCommentCommandList(Records, OS);
448     break;
449   case GenClangOpenCLBuiltins:
450     EmitClangOpenCLBuiltins(Records, OS);
451     break;
452   case GenClangOpenCLBuiltinHeader:
453     EmitClangOpenCLBuiltinHeader(Records, OS);
454     break;
455   case GenClangOpenCLBuiltinTests:
456     EmitClangOpenCLBuiltinTests(Records, OS);
457     break;
458   case GenClangSyntaxNodeList:
459     EmitClangSyntaxNodeList(Records, OS);
460     break;
461   case GenClangSyntaxNodeClasses:
462     EmitClangSyntaxNodeClasses(Records, OS);
463     break;
464   case GenArmNeon:
465     EmitNeon(Records, OS);
466     break;
467   case GenArmFP16:
468     EmitFP16(Records, OS);
469     break;
470   case GenArmVectorType:
471     EmitVectorTypes(Records, OS);
472     break;
473   case GenArmBF16:
474     EmitBF16(Records, OS);
475     break;
476   case GenArmNeonSema:
477     EmitNeonSema(Records, OS);
478     break;
479   case GenArmNeonTest:
480     EmitNeonTest(Records, OS);
481     break;
482   case GenArmMveHeader:
483     EmitMveHeader(Records, OS);
484     break;
485   case GenArmMveBuiltinDef:
486     EmitMveBuiltinDef(Records, OS);
487     break;
488   case GenArmMveBuiltinSema:
489     EmitMveBuiltinSema(Records, OS);
490     break;
491   case GenArmMveBuiltinCG:
492     EmitMveBuiltinCG(Records, OS);
493     break;
494   case GenArmMveBuiltinAliases:
495     EmitMveBuiltinAliases(Records, OS);
496     break;
497   case GenArmSveHeader:
498     EmitSveHeader(Records, OS);
499     break;
500   case GenArmSveBuiltins:
501     EmitSveBuiltins(Records, OS);
502     break;
503   case GenArmSveBuiltinCG:
504     EmitSveBuiltinCG(Records, OS);
505     break;
506   case GenArmSveTypeFlags:
507     EmitSveTypeFlags(Records, OS);
508     break;
509   case GenArmSveRangeChecks:
510     EmitSveRangeChecks(Records, OS);
511     break;
512   case GenArmSveStreamingAttrs:
513     EmitSveStreamingAttrs(Records, OS);
514     break;
515   case GenArmSmeHeader:
516     EmitSmeHeader(Records, OS);
517     break;
518   case GenArmSmeBuiltins:
519     EmitSmeBuiltins(Records, OS);
520     break;
521   case GenArmSmeBuiltinCG:
522     EmitSmeBuiltinCG(Records, OS);
523     break;
524   case GenArmSmeRangeChecks:
525     EmitSmeRangeChecks(Records, OS);
526     break;
527   case GenArmSmeStreamingAttrs:
528     EmitSmeStreamingAttrs(Records, OS);
529     break;
530   case GenArmSmeBuiltinZAState:
531     EmitSmeBuiltinZAState(Records, OS);
532     break;
533   case GenArmCdeHeader:
534     EmitCdeHeader(Records, OS);
535     break;
536   case GenArmCdeBuiltinDef:
537     EmitCdeBuiltinDef(Records, OS);
538     break;
539   case GenArmCdeBuiltinSema:
540     EmitCdeBuiltinSema(Records, OS);
541     break;
542   case GenArmCdeBuiltinCG:
543     EmitCdeBuiltinCG(Records, OS);
544     break;
545   case GenArmCdeBuiltinAliases:
546     EmitCdeBuiltinAliases(Records, OS);
547     break;
548   case GenRISCVVectorHeader:
549     EmitRVVHeader(Records, OS);
550     break;
551   case GenRISCVVectorBuiltins:
552     EmitRVVBuiltins(Records, OS);
553     break;
554   case GenRISCVVectorBuiltinCG:
555     EmitRVVBuiltinCG(Records, OS);
556     break;
557   case GenRISCVVectorBuiltinSema:
558     EmitRVVBuiltinSema(Records, OS);
559     break;
560   case GenRISCVSiFiveVectorBuiltins:
561     EmitRVVBuiltins(Records, OS);
562     break;
563   case GenRISCVSiFiveVectorBuiltinCG:
564     EmitRVVBuiltinCG(Records, OS);
565     break;
566   case GenRISCVSiFiveVectorBuiltinSema:
567     EmitRVVBuiltinSema(Records, OS);
568     break;
569   case GenAttrDocs:
570     EmitClangAttrDocs(Records, OS);
571     break;
572   case GenDiagDocs:
573     EmitClangDiagDocs(Records, OS);
574     break;
575   case GenOptDocs:
576     EmitClangOptDocs(Records, OS);
577     break;
578   case GenDataCollectors:
579     EmitClangDataCollectors(Records, OS);
580     break;
581   case GenTestPragmaAttributeSupportedAttributes:
582     EmitTestPragmaAttributeSupportedAttributes(Records, OS);
583     break;
584   }
585 
586   return false;
587 }
588 }
589 
590 int main(int argc, char **argv) {
591   sys::PrintStackTraceOnErrorSignal(argv[0]);
592   PrettyStackTraceProgram X(argc, argv);
593   cl::ParseCommandLineOptions(argc, argv);
594 
595   llvm_shutdown_obj Y;
596 
597   return TableGenMain(argv[0], &ClangTableGenMain);
598 }
599 
600 #ifdef __has_feature
601 #if __has_feature(address_sanitizer)
602 #include <sanitizer/lsan_interface.h>
603 // Disable LeakSanitizer for this binary as it has too many leaks that are not
604 // very interesting to fix. See compiler-rt/include/sanitizer/lsan_interface.h .
605 int __lsan_is_turned_off() { return 1; }
606 #endif  // __has_feature(address_sanitizer)
607 #endif  // defined(__has_feature)
608