From 1f80a927d416eadb9115a0c2fd4f7e08c3851ee2 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 --- llvm/tools/bugpoint/ExecutionDriver.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp index ecf9dc8a582b..01f7be89e35a 100644 --- a/llvm/tools/bugpoint/ExecutionDriver.cpp +++ b/llvm/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; }