From 39e49b19400a75e470cea2c8baf153408f81edac Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 18 Feb 2004 22:01:21 +0000 Subject: [PATCH] Make the executeProgram method exception safe, not leaving around bytecode files. llvm-svn: 11607 --- tools/bugpoint/ExecutionDriver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp index ecf9dc8a582..01f7be89e35 100644 --- a/tools/bugpoint/ExecutionDriver.cpp +++ b/tools/bugpoint/ExecutionDriver.cpp @@ -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; }