aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-08-18 21:23:17 +0000
committerDan Gohman <gohman@apple.com>2010-08-18 21:23:17 +0000
commit726578c22e9e33774435257664f8f6dc4cf8dfa9 (patch)
tree1e3d84bd972afbed32a958a0de0b7e8dbcbd60a2
parent245adabd97c8c770c13935a9075f2243cc6f1d57 (diff)
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
-rw-r--r--tools/driver/cc1_main.cpp5
-rw-r--r--tools/driver/cc1as_main.cpp4
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<void*>(&Diags));
+ ScopedFatalErrorHandler FatalErrorHandler
+ (LLVMErrorHandler, static_cast<void*>(&Diags));
// Parse the arguments.
AssemblerInvocation Asm;