diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-07-28 18:12:30 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-07-28 18:12:30 +0000 |
commit | bae1b71cbb930e419df03db209ebc547a0e4ec72 (patch) | |
tree | ce3e887d6ec9ade7998596616384c5fba4f630f8 /tools/bugpoint/OptimizerDriver.cpp | |
parent | c19d865474aae26797873c55830179b522e1a318 (diff) | |
download | llvm-bae1b71cbb930e419df03db209ebc547a0e4ec72.tar.gz llvm-bae1b71cbb930e419df03db209ebc547a0e4ec72.tar.bz2 llvm-bae1b71cbb930e419df03db209ebc547a0e4ec72.tar.xz |
Instead of abusing swapProgramIn, just add a Module argument to
EmitProgressBitcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109602 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/bugpoint/OptimizerDriver.cpp')
-rw-r--r-- | tools/bugpoint/OptimizerDriver.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp index 3a6149b24a..48936caf5f 100644 --- a/tools/bugpoint/OptimizerDriver.cpp +++ b/tools/bugpoint/OptimizerDriver.cpp @@ -51,13 +51,13 @@ namespace { /// file. If an error occurs, true is returned. /// bool BugDriver::writeProgramToFile(const std::string &Filename, - Module *M) const { + const Module *M) const { std::string ErrInfo; raw_fd_ostream Out(Filename.c_str(), ErrInfo, raw_fd_ostream::F_Binary); if (!ErrInfo.empty()) return true; - WriteBitcodeToFile(M ? M : Program, Out); + WriteBitcodeToFile(M, Out); return false; } @@ -65,12 +65,13 @@ bool BugDriver::writeProgramToFile(const std::string &Filename, /// EmitProgressBitcode - This function is used to output the current Program /// to a file named "bugpoint-ID.bc". /// -void BugDriver::EmitProgressBitcode(const std::string &ID, bool NoFlyer) { +void BugDriver::EmitProgressBitcode(const Module *M, + const std::string &ID, bool NoFlyer) { // 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 = OutputPrefix + "-" + ID + ".bc"; - if (writeProgramToFile(Filename)) { + if (writeProgramToFile(Filename, M)) { errs() << "Error opening file '" << Filename << "' for writing!\n"; return; } @@ -246,7 +247,7 @@ Module *BugDriver::runPassesOn(Module *M, errs() << " Error running this sequence of passes" << " on the input program!\n"; delete OldProgram; - EmitProgressBitcode("pass-error", false); + EmitProgressBitcode(Program, "pass-error", false); exit(debugOptimizerCrash()); } swapProgramIn(OldProgram); |