Add a Module argument to the remaining runPasses methods and mark getContext

const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110300 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola 2010-08-05 02:16:32 +00:00
parent 02a8f76d58
commit 5d8cace94a
3 changed files with 8 additions and 11 deletions

View File

@ -172,7 +172,7 @@ bool BugDriver::run(std::string &ErrMsg) {
// miscompilation. // miscompilation.
if (!PassesToRun.empty()) { if (!PassesToRun.empty()) {
outs() << "Running selected passes on program to test for crash: "; outs() << "Running selected passes on program to test for crash: ";
if (runPasses(PassesToRun)) if (runPasses(Program, PassesToRun))
return debugOptimizerCrash(); return debugOptimizerCrash();
} }

View File

@ -69,7 +69,7 @@ public:
const char *getToolName() const { return ToolName; } const char *getToolName() const { return ToolName; }
LLVMContext& getContext() { return Context; } LLVMContext& getContext() const { return Context; }
// Set up methods... these methods are used to copy information about the // Set up methods... these methods are used to copy information about the
// command line arguments into instance variables of BugDriver. // command line arguments into instance variables of BugDriver.
@ -132,12 +132,8 @@ public:
/// runPasses - Run all of the passes in the "PassesToRun" list, discard the /// runPasses - Run all of the passes in the "PassesToRun" list, discard the
/// output, and return true if any of the passes crashed. /// output, and return true if any of the passes crashed.
bool runPasses(Module *M = 0) { bool runPasses(Module *M) const {
if (M == 0) M = Program; return runPasses(M, PassesToRun);
std::swap(M, Program);
bool Result = runPasses(PassesToRun);
std::swap(M, Program);
return Result;
} }
Module *getProgram() const { return Program; } Module *getProgram() const { return Program; }
@ -287,10 +283,11 @@ private:
/// false indicating whether or not the optimizer crashed on the specified /// false indicating whether or not the optimizer crashed on the specified
/// input (true = crashed). /// input (true = crashed).
/// ///
bool runPasses(const std::vector<const PassInfo*> &PassesToRun, bool runPasses(Module *M,
const std::vector<const PassInfo*> &PassesToRun,
bool DeleteOutput = true) const { bool DeleteOutput = true) const {
std::string Filename; std::string Filename;
return runPasses(Program, PassesToRun, Filename, DeleteOutput); return runPasses(M, PassesToRun, Filename, DeleteOutput);
} }
/// runAsChild - The actual "runPasses" guts that runs in a child process. /// runAsChild - The actual "runPasses" guts that runs in a child process.

View File

@ -86,7 +86,7 @@ ReducePassList::doTest(std::vector<const PassInfo*> &Prefix,
outs() << "Checking to see if these passes crash: " outs() << "Checking to see if these passes crash: "
<< getPassesString(Suffix) << ": "; << getPassesString(Suffix) << ": ";
if (BD.runPasses(Suffix)) { if (BD.runPasses(BD.getProgram(), Suffix)) {
delete OrigProgram; // The suffix crashes alone... delete OrigProgram; // The suffix crashes alone...
return KeepSuffix; return KeepSuffix;
} }