From ad6e96d59c597aeccbdb1c2b0d749fbe4dee762d Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Mon, 12 Nov 2012 21:32:24 +0000 Subject: [PATCH] If we encounter a fatal error, exit with status 70. For BSD systems this is defined as an internal software error. This notifies the driver to report diagnostics information. rdar://11951540 llvm-svn: 167754 --- clang/tools/driver/cc1_main.cpp | 6 ++++-- clang/tools/driver/driver.cpp | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp index 674f2ad..9da6723 100644 --- a/clang/tools/driver/cc1_main.cpp +++ b/clang/tools/driver/cc1_main.cpp @@ -48,8 +48,10 @@ static void LLVMErrorHandler(void *UserData, const std::string &Message) { // particular that we remove files registered with RemoveFileOnSignal. llvm::sys::RunInterruptHandlers(); - // We cannot recover from llvm errors. - exit(1); + // We cannot recover from llvm errors. When reporting a fatal error, exit + // with status 70. For BSD systems this is defined as an internal software + // error. This notifies the driver to report diagnostics information. + exit(70); } int cc1_main(const char **ArgBegin, const char **ArgEnd, diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp index 81979ec..8233247 100644 --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -480,8 +480,9 @@ int main(int argc_, const char **argv_) { Res = -1; // If result status is < 0, then the driver command signalled an error. - // In this case, generate additional diagnostic information if possible. - if (Res < 0) + // If result status is 70, then the driver command reported a fatal error. + // In these cases, generate additional diagnostic information if possible. + if (Res < 0 || Res == 70) TheDriver.generateCompilationDiagnostics(*C, FailingCommand); // If any timers were active but haven't been destroyed yet, print their -- 2.7.4