Don't leave dead bytecode.output files around if the optimizer/block extractor crashes.
authorChris Lattner <sabre@nondot.org>
Wed, 12 May 2004 02:55:45 +0000 (02:55 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 May 2004 02:55:45 +0000 (02:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13477 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/OptimizerDriver.cpp

index ad69caaec6e3807761eefcce0a613a5af191aa54..c5c437ccdb8fe71e3f48b75ccae71182af180af3 100644 (file)
@@ -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)