#include <fstream>
using namespace llvm;
+namespace llvm {
+ extern cl::opt<std::string> OutputPrefix;
+}
namespace {
// ChildOutput - This option captures the name of the child output file that
// is set up by the parent bugpoint process
cl::opt<std::string> ChildOutput("child-output", cl::ReallyHidden);
- cl::opt<bool> UseValgrind("enable-valgrind",
- cl::desc("Run optimizations through valgrind"));
}
/// writeProgramToFile - This writes the current "Program" to the named bitcode
Module *M) const {
std::string ErrInfo;
raw_fd_ostream Out(Filename.c_str(), ErrInfo,
- raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+ raw_fd_ostream::F_Binary);
if (!ErrInfo.empty()) return true;
WriteBitcodeToFile(M ? M : Program, Out);
// Output the input to the current pass to a bitcode file, emit a message
// telling the user how to reproduce it: opt -foo blah.bc
//
- std::string Filename = "bugpoint-" + ID + ".bc";
+ std::string Filename = OutputPrefix + "-" + ID + ".bc";
if (writeProgramToFile(Filename)) {
errs() << "Error opening file '" << Filename << "' for writing!\n";
return;
int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
std::string ErrInfo;
raw_fd_ostream OutFile(ChildOutput.c_str(), ErrInfo,
- raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+ raw_fd_ostream::F_Binary);
if (!ErrInfo.empty()) {
errs() << "Error opening bitcode file: " << ChildOutput << "\n";
return 1;
const char * const *ExtraArgs) const {
// setup the output file name
outs().flush();
- sys::Path uniqueFilename("bugpoint-output.bc");
+ sys::Path uniqueFilename(OutputPrefix + "-output.bc");
std::string ErrMsg;
if (uniqueFilename.makeUnique(true, &ErrMsg)) {
errs() << getToolName() << ": Error making unique filename: "
OutputFilename = uniqueFilename.str();
// set up the input file name
- sys::Path inputFilename("bugpoint-input.bc");
+ sys::Path inputFilename(OutputPrefix + "-input.bc");
if (inputFilename.makeUnique(true, &ErrMsg)) {
errs() << getToolName() << ": Error making unique filename: "
<< ErrMsg << "\n";
std::string ErrInfo;
raw_fd_ostream InFile(inputFilename.c_str(), ErrInfo,
- raw_fd_ostream::F_Force|raw_fd_ostream::F_Binary);
+ raw_fd_ostream::F_Binary);
if (!ErrInfo.empty()) {