summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/TableGen/Error.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/TableGen/Error.cpp')
-rw-r--r--contrib/llvm/lib/TableGen/Error.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/llvm/lib/TableGen/Error.cpp b/contrib/llvm/lib/TableGen/Error.cpp
index 0bb86b0..928b120 100644
--- a/contrib/llvm/lib/TableGen/Error.cpp
+++ b/contrib/llvm/lib/TableGen/Error.cpp
@@ -15,15 +15,20 @@
#include "llvm/TableGen/Error.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/raw_ostream.h"
-
#include <cstdlib>
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