From: Chris Lattner Date: Wed, 18 Feb 2004 22:01:21 +0000 (+0000) Subject: Make the executeProgram method exception safe, not leaving around bytecode X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9709272675feaca030cce14d0f5eb7f342b3fc1d;p=oota-llvm.git Make the executeProgram method exception safe, not leaving around bytecode files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11607 91177308-0d34-0410-b5e6-96231b3b80d8 --- 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; }