aboutsummaryrefslogtreecommitdiffstats
path: root/lib/TableGen/Main.cpp
diff options
context:
space:
mode:
authorSean Silva <silvas@purdue.edu>2012-10-03 21:29:18 +0000
committerSean Silva <silvas@purdue.edu>2012-10-03 21:29:18 +0000
commitf42a6741de5eda904a7c7b02731f0b019bbe0c5c (patch)
tree802e9874f47a1c64769f490a68a7ffaacac47b07 /lib/TableGen/Main.cpp
parentec7559db6d4d7e8f3cbeea8b7f2174318b3e8918 (diff)
downloadexternal_llvm-f42a6741de5eda904a7c7b02731f0b019bbe0c5c.zip
external_llvm-f42a6741de5eda904a7c7b02731f0b019bbe0c5c.tar.gz
external_llvm-f42a6741de5eda904a7c7b02731f0b019bbe0c5c.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/TableGen/Main.cpp')
-rw-r--r--lib/TableGen/Main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/TableGen/Main.cpp b/lib/TableGen/Main.cpp
index 7aeef56..83bc66f 100644
--- a/lib/TableGen/Main.cpp
+++ b/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;