Make the executeProgram method exception safe, not leaving around bytecode
authorChris Lattner <sabre@nondot.org>
Wed, 18 Feb 2004 22:01:21 +0000 (22:01 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 18 Feb 2004 22:01:21 +0000 (22:01 +0000)
files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11607 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/ExecutionDriver.cpp

index ecf9dc8a582b970e91aea1a767ea39815edd8ba3..01f7be89e35a8465e9bd4413f53a1a58f6c7be71 100644 (file)
@@ -162,6 +162,9 @@ std::string BugDriver::executeProgram(std::string OutputFile,
     CreatedBytecode = true;
   }
 
+  // Remove the temporary bytecode file when we are done.
+  FileRemover BytecodeFileRemover(BytecodeFile, CreatedBytecode);
+
   if (OutputFile.empty()) OutputFile = "bugpoint-execution-output";
 
   // Check to see if this is a valid output filename...
@@ -179,9 +182,6 @@ std::string BugDriver::executeProgram(std::string OutputFile,
   if (ProgramExitedNonzero != 0)
     *ProgramExitedNonzero = (RetVal != 0);
 
-  // Remove the temporary bytecode file.
-  if (CreatedBytecode) removeFile(BytecodeFile);
-
   // Return the filename we captured the output to.
   return OutputFile;
 }