[llvm-commits] [llvm] r166690 - in /llvm/trunk: include/llvm/TableGen/Error.h lib/TableGen/Error.cpp
Joerg Sonnenberger
joerg at bec.de
Thu Oct 25 09:35:18 PDT 2012
Author: joerg
Date: Thu Oct 25 11:35:18 2012
New Revision: 166690
URL: http://llvm.org/viewvc/llvm-project?rev=166690&view=rev
Log:
In preparation for removing exception handling in tablegen, add
PrintFatalError, which combines PrintError with exit(1).
Modified:
llvm/trunk/include/llvm/TableGen/Error.h
llvm/trunk/lib/TableGen/Error.cpp
Modified: llvm/trunk/include/llvm/TableGen/Error.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Error.h?rev=166690&r1=166689&r2=166690&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Error.h (original)
+++ llvm/trunk/include/llvm/TableGen/Error.h Thu Oct 25 11:35:18 2012
@@ -40,6 +40,9 @@
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;
Modified: llvm/trunk/lib/TableGen/Error.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/Error.cpp?rev=166690&r1=166689&r2=166690&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/Error.cpp (original)
+++ llvm/trunk/lib/TableGen/Error.cpp Thu Oct 25 11:35:18 2012
@@ -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 @@
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
More information about the llvm-commits
mailing list