Call llvm::remove_fatal_error_handler before deallocating objects

which are used by the error handling functions.

llvm-svn: 111427
This commit is contained in:
Dan Gohman 2010-08-18 21:23:17 +00:00
parent b9933f365e
commit b37af7de47
2 changed files with 7 additions and 2 deletions

View File

@ -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)

View File

@ -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;