From f85f39df47b2d8a3eff20b47e95d2a2cda508c39 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Wed, 3 Oct 2012 21:29:30 +0000 Subject: [PATCH] tblgen: Migrate clang-tblgen to new TableGenMain API. llvm-svn: 165167 --- clang/utils/TableGen/TableGen.cpp | 169 +++++++++++++++--------------- 1 file changed, 82 insertions(+), 87 deletions(-) diff --git a/clang/utils/TableGen/TableGen.cpp b/clang/utils/TableGen/TableGen.cpp index 4f7789dbef74..41471a484c69 100644 --- a/clang/utils/TableGen/TableGen.cpp +++ b/clang/utils/TableGen/TableGen.cpp @@ -19,7 +19,6 @@ #include "llvm/TableGen/Error.h" #include "llvm/TableGen/Main.h" #include "llvm/TableGen/Record.h" -#include "llvm/TableGen/TableGenAction.h" using namespace llvm; using namespace clang; @@ -123,91 +122,88 @@ namespace { cl::desc("Only use warnings from specified component"), cl::value_desc("component"), cl::Hidden); -class ClangTableGenAction : public TableGenAction { -public: - bool operator()(raw_ostream &OS, RecordKeeper &Records) { - switch (Action) { - case GenClangAttrClasses: - EmitClangAttrClass(Records, OS); - break; - case GenClangAttrImpl: - EmitClangAttrImpl(Records, OS); - break; - case GenClangAttrList: - EmitClangAttrList(Records, OS); - break; - case GenClangAttrPCHRead: - EmitClangAttrPCHRead(Records, OS); - break; - case GenClangAttrPCHWrite: - EmitClangAttrPCHWrite(Records, OS); - break; - case GenClangAttrSpellingList: - EmitClangAttrSpellingList(Records, OS); - break; - case GenClangAttrLateParsedList: - EmitClangAttrLateParsedList(Records, OS); - break; - case GenClangAttrTemplateInstantiate: - EmitClangAttrTemplateInstantiate(Records, OS); - break; - case GenClangAttrParsedAttrList: - EmitClangAttrParsedAttrList(Records, OS); - break; - case GenClangAttrParsedAttrKinds: - EmitClangAttrParsedAttrKinds(Records, OS); - break; - case GenClangDiagsDefs: - EmitClangDiagsDefs(Records, OS, ClangComponent); - break; - case GenClangDiagGroups: - EmitClangDiagGroups(Records, OS); - break; - case GenClangDiagsIndexName: - EmitClangDiagsIndexName(Records, OS); - break; - case GenClangCommentNodes: - EmitClangASTNodes(Records, OS, "Comment", ""); - break; - case GenClangDeclNodes: - EmitClangASTNodes(Records, OS, "Decl", "Decl"); - EmitClangDeclContext(Records, OS); - break; - case GenClangStmtNodes: - EmitClangASTNodes(Records, OS, "Stmt", ""); - break; - case GenClangSACheckers: - EmitClangSACheckers(Records, OS); - break; - case GenClangCommentHTMLTags: - EmitClangCommentHTMLTags(Records, OS); - break; - case GenClangCommentHTMLTagsProperties: - EmitClangCommentHTMLTagsProperties(Records, OS); - break; - case GenClangCommentCommandInfo: - EmitClangCommentCommandInfo(Records, OS); - break; - case GenOptParserDefs: - EmitOptParser(Records, OS, true); - break; - case GenOptParserImpl: - EmitOptParser(Records, OS, false); - break; - case GenArmNeon: - EmitNeon(Records, OS); - break; - case GenArmNeonSema: - EmitNeonSema(Records, OS); - break; - case GenArmNeonTest: - EmitNeonTest(Records, OS); - break; - } - - return false; +bool ClangTableGenMain(raw_ostream &OS, RecordKeeper &Records) { + switch (Action) { + case GenClangAttrClasses: + EmitClangAttrClass(Records, OS); + break; + case GenClangAttrImpl: + EmitClangAttrImpl(Records, OS); + break; + case GenClangAttrList: + EmitClangAttrList(Records, OS); + break; + case GenClangAttrPCHRead: + EmitClangAttrPCHRead(Records, OS); + break; + case GenClangAttrPCHWrite: + EmitClangAttrPCHWrite(Records, OS); + break; + case GenClangAttrSpellingList: + EmitClangAttrSpellingList(Records, OS); + break; + case GenClangAttrLateParsedList: + EmitClangAttrLateParsedList(Records, OS); + break; + case GenClangAttrTemplateInstantiate: + EmitClangAttrTemplateInstantiate(Records, OS); + break; + case GenClangAttrParsedAttrList: + EmitClangAttrParsedAttrList(Records, OS); + break; + case GenClangAttrParsedAttrKinds: + EmitClangAttrParsedAttrKinds(Records, OS); + break; + case GenClangDiagsDefs: + EmitClangDiagsDefs(Records, OS, ClangComponent); + break; + case GenClangDiagGroups: + EmitClangDiagGroups(Records, OS); + break; + case GenClangDiagsIndexName: + EmitClangDiagsIndexName(Records, OS); + break; + case GenClangCommentNodes: + EmitClangASTNodes(Records, OS, "Comment", ""); + break; + case GenClangDeclNodes: + EmitClangASTNodes(Records, OS, "Decl", "Decl"); + EmitClangDeclContext(Records, OS); + break; + case GenClangStmtNodes: + EmitClangASTNodes(Records, OS, "Stmt", ""); + break; + case GenClangSACheckers: + EmitClangSACheckers(Records, OS); + break; + case GenClangCommentHTMLTags: + EmitClangCommentHTMLTags(Records, OS); + break; + case GenClangCommentHTMLTagsProperties: + EmitClangCommentHTMLTagsProperties(Records, OS); + break; + case GenClangCommentCommandInfo: + EmitClangCommentCommandInfo(Records, OS); + break; + case GenOptParserDefs: + EmitOptParser(Records, OS, true); + break; + case GenOptParserImpl: + EmitOptParser(Records, OS, false); + break; + case GenArmNeon: + EmitNeon(Records, OS); + break; + case GenArmNeonSema: + EmitNeonSema(Records, OS); + break; + case GenArmNeonTest: + EmitNeonTest(Records, OS); + break; } -}; + + return false; +} } int main(int argc, char **argv) { @@ -215,6 +211,5 @@ int main(int argc, char **argv) { PrettyStackTraceProgram X(argc, argv); cl::ParseCommandLineOptions(argc, argv); - ClangTableGenAction Action; - return TableGenMain(argv[0], Action); + return TableGenMain(argv[0], &ClangTableGenMain); }