diff options
author | Sean Silva <silvas@purdue.edu> | 2012-10-03 21:29:18 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2012-10-03 21:29:18 +0000 |
commit | 8c6c7de2169289b79732a21f90f74d5e06c97d4a (patch) | |
tree | 486d0e585fb369b19b352e096cf3ba11eee63c28 /llvm/lib | |
parent | a1ed4aa17d07b8d71b5a82505aa0a2d338505190 (diff) | |
download | bcm5719-llvm-8c6c7de2169289b79732a21f90f74d5e06c97d4a.tar.gz bcm5719-llvm-8c6c7de2169289b79732a21f90f74d5e06c97d4a.zip |
tblgen: Put new TableGenMain API in place.
In order to avoid rev-lock with Clang when moving to the new API, also
preserve the current API temporarily and insert a shim to implement the
new API in terms of the old.
llvm-svn: 165165
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/TableGen/Main.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/Main.cpp b/llvm/lib/TableGen/Main.cpp index 7aeef563b85..83bc66f4608 100644 --- a/llvm/lib/TableGen/Main.cpp +++ b/llvm/lib/TableGen/Main.cpp @@ -22,6 +22,7 @@ #include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/system_error.h" #include "llvm/TableGen/Error.h" +#include "llvm/TableGen/Main.h" #include "llvm/TableGen/Record.h" #include "llvm/TableGen/TableGenAction.h" #include <algorithm> @@ -47,8 +48,26 @@ namespace { cl::value_desc("directory"), cl::Prefix); } +namespace { +// XXX: this is a crutch for transitioning to the new TableGenMain API +// (with a TableGenMainFn* instead of a pointless class). +class StubTransitionalTableGenAction : public TableGenAction { + TableGenMainFn *MainFn; +public: + StubTransitionalTableGenAction(TableGenMainFn *M) : MainFn(M) {} + bool operator()(raw_ostream &OS, RecordKeeper &Records) { + return MainFn(OS, Records); + } +}; +} + namespace llvm { +int TableGenMain(char *argv0, TableGenMainFn *MainFn) { + StubTransitionalTableGenAction Action(MainFn); + return TableGenMain(argv0, Action); +} + int TableGenMain(char *argv0, TableGenAction &Action) { RecordKeeper Records; |