TableGen.cpp 19 KB

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