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