summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/Error.cpp
diff options
context:
space:
mode:
authorJakob Stoklund Olesen <stoklund@2pi.dk>2013-03-20 20:43:11 +0000
committerJakob Stoklund Olesen <stoklund@2pi.dk>2013-03-20 20:43:11 +0000
commita1214e76bd68c031cb79232c71b6a130f93c6f68 (patch)
tree759e30421c87acd00d3ebb39cdb2e01e738dad86 /llvm/lib/TableGen/Error.cpp
parent28c68a2d07f0b9b09091fcff14c540efe4d8dc6f (diff)
downloadbcm5719-llvm-a1214e76bd68c031cb79232c71b6a130f93c6f68.tar.gz
bcm5719-llvm-a1214e76bd68c031cb79232c71b6a130f93c6f68.zip
Make sure TableGen exits with an error code after printing errors.
This makes it possible to report multiple errors in one invocation. There are already calls to PrintError in CodeGenDAGPatterns.cpp which previously would not cause TableGen to fail. <rdar://problem/13463339> llvm-svn: 177573
Diffstat (limited to 'llvm/lib/TableGen/Error.cpp')
-rw-r--r--llvm/lib/TableGen/Error.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/Error.cpp b/llvm/lib/TableGen/Error.cpp
index ec84a72454f..928b1203cd8 100644
--- a/llvm/lib/TableGen/Error.cpp
+++ b/llvm/lib/TableGen/Error.cpp
@@ -20,9 +20,15 @@
namespace llvm {
SourceMgr SrcMgr;
+unsigned ErrorsPrinted = 0;
static void PrintMessage(ArrayRef<SMLoc> Loc, SourceMgr::DiagKind Kind,
const Twine &Msg) {
+ // Count the total number of errors printed.
+ // This is used to exit with an error code if there were any errors.
+ if (Kind == SourceMgr::DK_Error)
+ ++ErrorsPrinted;
+
SMLoc NullLoc;
if (Loc.empty())
Loc = NullLoc;
OpenPOWER on IntegriCloud