aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/TableGen/Error.h3
-rw-r--r--lib/TableGen/Error.cpp12
2 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/TableGen/Error.h b/include/llvm/TableGen/Error.h
index 5c1c3ad..3f7b7f4 100644
--- a/include/llvm/TableGen/Error.h
+++ b/include/llvm/TableGen/Error.h
@@ -40,6 +40,9 @@ void PrintError(const char *Loc, const Twine &Msg);
void PrintError(const Twine &Msg);
void PrintError(const TGError &Error);
+LLVM_ATTRIBUTE_NORETURN void PrintFatalError(const std::string &Msg);
+LLVM_ATTRIBUTE_NORETURN void PrintFatalError(ArrayRef<SMLoc> ErrorLoc,
+ const std::string &Msg);
extern SourceMgr SrcMgr;
diff --git a/lib/TableGen/Error.cpp b/lib/TableGen/Error.cpp
index 5dd688c..ad98fba 100644
--- a/lib/TableGen/Error.cpp
+++ b/lib/TableGen/Error.cpp
@@ -16,6 +16,8 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
+#include <cstdlib>
+
namespace llvm {
SourceMgr SrcMgr;
@@ -63,4 +65,14 @@ void PrintError(const TGError &Error) {
PrintError(Error.getLoc(), Error.getMessage());
}
+void PrintFatalError(const std::string &Msg) {
+ PrintError(Twine(Msg));
+ std::exit(1);
+}
+
+void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const std::string &Msg) {
+ PrintError(ErrorLoc, Msg);
+ std::exit(1);
+}
+
} // end namespace llvm