aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;