mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
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
This commit is contained in:
parent
6ddc4bafc5
commit
5e8ed26fe2
@ -32,6 +32,7 @@ LLVM_ATTRIBUTE_NORETURN void PrintFatalError(ArrayRef<SMLoc> ErrorLoc,
|
||||
const std::string &Msg);
|
||||
|
||||
extern SourceMgr SrcMgr;
|
||||
extern unsigned ErrorsPrinted;
|
||||
|
||||
|
||||
} // end namespace "llvm"
|
||||
|
@ -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;
|
||||
|
@ -117,11 +117,14 @@ int TableGenMain(char *argv0, TableGenMainFn *MainFn) {
|
||||
if (MainFn(Out.os(), Records))
|
||||
return 1;
|
||||
|
||||
if (ErrorsPrinted > 0) {
|
||||
errs() << argv0 << ": " << ErrorsPrinted << " errors.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Declare success.
|
||||
Out.keep();
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user