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 6e7c1e5c5c
commit 39e49b1940

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