summaryrefslogtreecommitdiff
path: root/tools/bugpoint/OptimizerDriver.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-05-12 02:55:45 +0000
committerChris Lattner <sabre@nondot.org>2004-05-12 02:55:45 +0000
commitb83c0f3f6391e5f8039305ec267f7cd43ffb4de9 (patch)
treeb68140e19a3059e31752311b1ed3a0448be305af /tools/bugpoint/OptimizerDriver.cpp
parentb584c5d81223b9ee4ebb0e6e0dc3a8e837d36eaa (diff)
downloadllvm-b83c0f3f6391e5f8039305ec267f7cd43ffb4de9.tar.gz
llvm-b83c0f3f6391e5f8039305ec267f7cd43ffb4de9.tar.bz2
llvm-b83c0f3f6391e5f8039305ec267f7cd43ffb4de9.tar.xz
Don't leave dead bytecode.output files around if the optimizer/block extractor crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/OptimizerDriver.cpp')
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index ad69caaec6..c5c437ccdb 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -135,13 +135,12 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
exit(1);
}
- // If we are supposed to delete the bytecode file, remove it now
- // unconditionally... this may fail if the file was never created, but that's
- // ok.
- if (DeleteOutput)
- removeFile(OutputFilename);
-
bool ExitedOK = WIFEXITED(Status) && WEXITSTATUS(Status) == 0;
+
+ // If we are supposed to delete the bytecode file or if the passes crashed,
+ // remove it now. This may fail if the file was never created, but that's ok.
+ if (DeleteOutput || !ExitedOK)
+ removeFile(OutputFilename);
if (!Quiet) {
if (ExitedOK)