Add a Module argument to the remaining runPasses methods and mark getContext
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 5 Aug 2010 02:16:32 +0000 (02:16 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 5 Aug 2010 02:16:32 +0000 (02:16 +0000)
const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110300 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/BugDriver.cpp
tools/bugpoint/BugDriver.h
tools/bugpoint/CrashDebugger.cpp

index d5b0656019d1722716e7e894cd34c86f9184fc4e..cf7b1832187ceb7b42008ba29d80aea53b0fc67c 100644 (file)
@@ -172,7 +172,7 @@ bool BugDriver::run(std::string &ErrMsg) {
   // miscompilation.
   if (!PassesToRun.empty()) {
     outs() << "Running selected passes on program to test for crash: ";
-    if (runPasses(PassesToRun))
+    if (runPasses(Program, PassesToRun))
       return debugOptimizerCrash();
   }
 
index 819379d6e9c37e42574f8cae9cada18c32ca3ee1..96113552d6065b638f9930ba4a23d0d265d19f20 100644 (file)
@@ -69,7 +69,7 @@ public:
 
   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
   // 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
   /// output, and return true if any of the passes crashed.
-  bool runPasses(Module *M = 0) {
-    if (M == 0) M = Program;
-    std::swap(M, Program);
-    bool Result = runPasses(PassesToRun);
-    std::swap(M, Program);
-    return Result;
+  bool runPasses(Module *M) const {
+    return runPasses(M, PassesToRun);
   }
 
   Module *getProgram() const { return Program; }
@@ -287,10 +283,11 @@ private:
   /// false indicating whether or not the optimizer crashed on the specified
   /// 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 {
     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.
index 735adc57384985ca60e44310a0e70438a60aa7cf..c423203389030e6ecf5e1e309a7a7c4625a4a518 100644 (file)
@@ -86,7 +86,7 @@ ReducePassList::doTest(std::vector<const PassInfo*> &Prefix,
   outs() << "Checking to see if these passes crash: "
          << getPassesString(Suffix) << ": ";
 
-  if (BD.runPasses(Suffix)) {
+  if (BD.runPasses(BD.getProgram(), Suffix)) {
     delete OrigProgram;            // The suffix crashes alone...
     return KeepSuffix;
   }