Make the executeProgram method exception safe, not leaving around bytecode

files.

llvm-svn: 11607
This commit is contained in:
Chris Lattner 2004-02-18 22:01:21 +00:00
parent b943b6b019
commit 1f80a927d4
1 changed files with 3 additions and 3 deletions

View 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;
}