projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
IR: Split up Constant{Array,Vector}::get(), NFC
[oota-llvm.git]
/
lib
/
TableGen
/
Error.cpp
diff --git
a/lib/TableGen/Error.cpp
b/lib/TableGen/Error.cpp
index ec84a72454f65a90a23e74ceea79b920c76d87f6..8d9ae20dd52eda1a6dc0b0c24a1f0b870553f0b5 100644
(file)
--- a/
lib/TableGen/Error.cpp
+++ b/
lib/TableGen/Error.cpp
@@
-20,9
+20,15
@@
namespace llvm {
SourceMgr SrcMgr;
namespace llvm {
SourceMgr SrcMgr;
+unsigned ErrorsPrinted = 0;
static void PrintMessage(ArrayRef<SMLoc> Loc, SourceMgr::DiagKind Kind,
const Twine &Msg) {
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;
SMLoc NullLoc;
if (Loc.empty())
Loc = NullLoc;
@@
-56,12
+62,12
@@
void PrintError(const Twine &Msg) {
errs() << "error:" << Msg << "\n";
}
errs() << "error:" << Msg << "\n";
}
-void PrintFatalError(const
std::string
&Msg) {
- PrintError(
Twine(Msg)
);
+void PrintFatalError(const
Twine
&Msg) {
+ PrintError(
Msg
);
std::exit(1);
}
std::exit(1);
}
-void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const
std::string
&Msg) {
+void PrintFatalError(ArrayRef<SMLoc> ErrorLoc, const
Twine
&Msg) {
PrintError(ErrorLoc, Msg);
std::exit(1);
}
PrintError(ErrorLoc, Msg);
std::exit(1);
}