diff --git a/llvm/tools/analyze/analyze.cpp b/llvm/tools/analyze/analyze.cpp index cc3a4780824a..79bcc4c5bdcf 100644 --- a/llvm/tools/analyze/analyze.cpp +++ b/llvm/tools/analyze/analyze.cpp @@ -19,17 +19,22 @@ struct ModulePassPrinter : public Pass { - Pass *PassToPrint; - ModulePassPrinter(Pass *PI) : PassToPrint(PI) {} + const PassInfo *PassToPrint; + ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {} virtual bool run(Module &M) { std::cout << "Printing Analysis info for Pass " << PassToPrint->getPassName() << ":\n"; - PassToPrint->print(std::cout, &M); + getAnalysis(PassToPrint).print(std::cout, &M); // Get and print pass... return false; } + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(PassToPrint); + AU.setPreservesAll(); + } }; struct FunctionPassPrinter : public FunctionPass { @@ -122,7 +127,7 @@ int main(int argc, char **argv) { else if (FunctionPass *FP = dynamic_cast(P)) Passes.add(new FunctionPassPrinter(Analysis)); else - Passes.add(new ModulePassPrinter(P)); + Passes.add(new ModulePassPrinter(Analysis)); } else cerr << "Cannot create pass: " << Analysis->getPassName() << "\n";