Set exit code properly on "Unexpected program action".

llvm-svn: 57080
This commit is contained in:
Daniel Dunbar 2008-10-04 23:42:49 +00:00
parent 2416896b3c
commit e773d5ff16
1 changed files with 4 additions and 1 deletions

View File

@ -54,6 +54,8 @@ using namespace clang;
// Global options.
//===----------------------------------------------------------------------===//
bool HadErrors = false;
static llvm::cl::opt<bool>
Verbose("v", llvm::cl::desc("Enable verbose output"));
static llvm::cl::opt<bool>
@ -1096,6 +1098,7 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
if (!Consumer) {
fprintf(stderr, "Unexpected program action!\n");
HadErrors = true;
return;
}
@ -1359,5 +1362,5 @@ int main(int argc, char **argv) {
fprintf(stderr, "\n");
}
return Diags.getNumErrors() != 0;
return HadErrors || (Diags.getNumErrors() != 0);
}