From af24e90c512e9d1b583548c8ddcfa127f68cfb45 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 12 May 2004 02:55:45 +0000 Subject: Don't leave dead bytecode.output files around if the optimizer/block extractor crashes. llvm-svn: 13477 --- llvm/tools/bugpoint/OptimizerDriver.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp index ad69caaec6e..c5c437ccdb8 100644 --- a/llvm/tools/bugpoint/OptimizerDriver.cpp +++ b/llvm/tools/bugpoint/OptimizerDriver.cpp @@ -135,13 +135,12 @@ bool BugDriver::runPasses(const std::vector &Passes, exit(1); } - // If we are supposed to delete the bytecode file, remove it now - // unconditionally... this may fail if the file was never created, but that's - // ok. - if (DeleteOutput) - removeFile(OutputFilename); - bool ExitedOK = WIFEXITED(Status) && WEXITSTATUS(Status) == 0; + + // If we are supposed to delete the bytecode file or if the passes crashed, + // remove it now. This may fail if the file was never created, but that's ok. + if (DeleteOutput || !ExitedOK) + removeFile(OutputFilename); if (!Quiet) { if (ExitedOK) -- cgit v1.2.3