// Make sure the reference output file gets deleted on exit from this
// function, if appropriate.
sys::Path ROF(ReferenceOutputFile);
- FileRemover RemoverInstance(ROF, CreatedOutput);
+ FileRemover RemoverInstance(ROF, CreatedOutput && !SaveTemps);
// Diff the output of the raw program against the reference output. If it
// matches, then we assume there is a miscompilation bug and try to
}
// Remove the temporary bitcode file when we are done.
- FileRemover BitcodeFileRemover(BitcodeFile);
+ FileRemover BitcodeFileRemover(BitcodeFile, !SaveTemps);
// Actually compile the program!
Interpreter->compileProgram(BitcodeFile.toString());
// Remove the temporary bitcode file when we are done.
sys::Path BitcodePath (BitcodeFile);
- FileRemover BitcodeFileRemover(BitcodePath, CreatedBitcode);
+ FileRemover BitcodeFileRemover(BitcodePath, CreatedBitcode && !SaveTemps);
if (OutputFile.empty()) OutputFile = "bugpoint-execution-output";
#include <sstream>
using namespace llvm;
+namespace llvm {
+ cl::opt<bool>
+ SaveTemps("save-temps", cl::init(false), cl::desc("Save temporary files"));
+}
+
namespace {
cl::opt<std::string>
RemoteClient("remote-client",
sys::Path OutputAsmFile;
OutputCode(Bitcode, OutputAsmFile);
- FileRemover OutFileRemover(OutputAsmFile);
+ FileRemover OutFileRemover(OutputAsmFile, !SaveTemps);
std::vector<std::string> GCCArgs(ArgsForGCC);
GCCArgs.insert(GCCArgs.end(), SharedLibs.begin(), SharedLibs.end());
sys::Path OutputCFile;
OutputCode(Bitcode, OutputCFile);
- FileRemover CFileRemove(OutputCFile);
+ FileRemover CFileRemove(OutputCFile, !SaveTemps);
std::vector<std::string> GCCArgs(ArgsForGCC);
GCCArgs.insert(GCCArgs.end(), SharedLibs.begin(), SharedLibs.end());
errs() << "\n";
);
- FileRemover OutputBinaryRemover(OutputBinary);
+ FileRemover OutputBinaryRemover(OutputBinary, !SaveTemps);
if (RemoteClientPath.isEmpty()) {
DEBUG(errs() << "<run locally>";);
#ifndef BUGPOINT_TOOLRUNNER_H
#define BUGPOINT_TOOLRUNNER_H
+#include "llvm/Support/CommandLine.h"
#include "llvm/Support/SystemUtils.h"
#include <exception>
#include <vector>
namespace llvm {
+extern cl::opt<bool> SaveTemps;
+
class CBE;
class LLC;