From 726578c22e9e33774435257664f8f6dc4cf8dfa9 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 18 Aug 2010 21:23:17 +0000 Subject: [PATCH] Call llvm::remove_fatal_error_handler before deallocating objects which are used by the error handling functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111427 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/driver/cc1_main.cpp | 5 +++++ tools/driver/cc1as_main.cpp | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/driver/cc1_main.cpp b/tools/driver/cc1_main.cpp index 2eb5fd381d..bfdcefbb24 100644 --- a/tools/driver/cc1_main.cpp +++ b/tools/driver/cc1_main.cpp @@ -163,6 +163,11 @@ int cc1_main(const char **ArgBegin, const char **ArgEnd, // results now. This happens in -disable-free mode. llvm::TimerGroup::printAll(llvm::errs()); + // Our error handler depends on the Diagnostics object, which we're + // potentially about to delete. Uninstall the handler now so that any + // later errors use the default handling behavior instead. + llvm::remove_fatal_error_handler(); + // When running with -disable-free, don't do any destruction or shutdown. if (Clang->getFrontendOpts().DisableFree) { if (Clang->getFrontendOpts().ShowStats) diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index 077e118d24..4620b605fb 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -327,8 +327,8 @@ int cc1as_main(const char **ArgBegin, const char **ArgEnd, // Set an error handler, so that any LLVM backend diagnostics go through our // error handler. - install_fatal_error_handler(LLVMErrorHandler, - static_cast(&Diags)); + ScopedFatalErrorHandler FatalErrorHandler + (LLVMErrorHandler, static_cast(&Diags)); // Parse the arguments. AssemblerInvocation Asm; -- 2.40.0