Make the executeProgram method exception safe, not leaving around bytecode
files. llvm-svn: 11607
This commit is contained in:
parent
b943b6b019
commit
1f80a927d4
|
@ -162,6 +162,9 @@ std::string BugDriver::executeProgram(std::string OutputFile,
|
||||||
CreatedBytecode = true;
|
CreatedBytecode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove the temporary bytecode file when we are done.
|
||||||
|
FileRemover BytecodeFileRemover(BytecodeFile, CreatedBytecode);
|
||||||
|
|
||||||
if (OutputFile.empty()) OutputFile = "bugpoint-execution-output";
|
if (OutputFile.empty()) OutputFile = "bugpoint-execution-output";
|
||||||
|
|
||||||
// Check to see if this is a valid output filename...
|
// Check to see if this is a valid output filename...
|
||||||
|
@ -179,9 +182,6 @@ std::string BugDriver::executeProgram(std::string OutputFile,
|
||||||
if (ProgramExitedNonzero != 0)
|
if (ProgramExitedNonzero != 0)
|
||||||
*ProgramExitedNonzero = (RetVal != 0);
|
*ProgramExitedNonzero = (RetVal != 0);
|
||||||
|
|
||||||
// Remove the temporary bytecode file.
|
|
||||||
if (CreatedBytecode) removeFile(BytecodeFile);
|
|
||||||
|
|
||||||
// Return the filename we captured the output to.
|
// Return the filename we captured the output to.
|
||||||
return OutputFile;
|
return OutputFile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue