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