From 9083628fec737679eb95abe8e2e5e23717a96e18 Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Wed, 27 Mar 2013 18:28:23 +0000 Subject: Update the error handing static functions for r178161. Part of rdar://13296693 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178162 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/driver/cc1_main.cpp | 9 +++++---- tools/driver/cc1as_main.cpp | 3 ++- tools/libclang/CIndex.cpp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index f54c87898c..35cf5b8735 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -39,7 +39,8 @@ using namespace clang; // Main driver //===----------------------------------------------------------------------===// -static void LLVMErrorHandler(void *UserData, const std::string &Message) { +static void LLVMErrorHandler(void *UserData, const std::string &Message, + bool GenCrashDiag) { DiagnosticsEngine &Diags = *static_cast(UserData); Diags.Report(diag::err_fe_error_backend) << Message; @@ -49,9 +50,9 @@ static void LLVMErrorHandler(void *UserData, const std::string &Message) { llvm::sys::RunInterruptHandlers(); // 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); + // with status 70 to generate crash diagnostics. For BSD systems this is + // defined as an internal software error. Otherwise, exit with status 1. + exit(GenCrashDiag ? 70 : 1); } int cc1_main(const char **ArgBegin, const char **ArgEnd, diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index 726af19af6..232ea2f668 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -384,7 +384,8 @@ static bool ExecuteAssembler(AssemblerInvocation &Opts, return Success; } -static void LLVMErrorHandler(void *UserData, const std::string &Message) { +static void LLVMErrorHandler(void *UserData, const std::string &Message, + bool GenCrashDiag) { DiagnosticsEngine &Diags = *static_cast(UserData); Diags.Report(diag::err_fe_error_backend) << Message; diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 3c75e441b7..59a7e8d112 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2456,7 +2456,8 @@ RefNamePieces buildPieces(unsigned NameFlags, bool IsMemberRefExpr, static llvm::sys::Mutex EnableMultithreadingMutex; static bool EnabledMultithreading; -static void fatal_error_handler(void *user_data, const std::string& reason) { +static void fatal_error_handler(void *user_data, const std::string& reason, + bool gen_crash_diag) { // Write the result out to stderr avoiding errs() because raw_ostreams can // call report_fatal_error. fprintf(stderr, "LIBCLANG FATAL ERROR: %s\n", reason.c_str()); -- cgit v1.2.3-18-g5258