diff options
author | Chris Lattner <sabre@nondot.org> | 2009-08-23 06:03:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-08-23 06:03:38 +0000 |
commit | 45cfe545ec8177262dabc70580ce05feaa1c3880 (patch) | |
tree | d7e42a138f6f8b54e1a831aff3c73c653ee77784 /tools/opt/AnalysisWrappers.cpp | |
parent | cb3e3d30054edfc7481bf323b315da4edc63bc44 (diff) |
Change Pass::print to take a raw ostream instead of std::ostream,
update all code that this affects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79830 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/AnalysisWrappers.cpp')
-rw-r--r-- | tools/opt/AnalysisWrappers.cpp | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index 2ab69ea61e..18360f837e 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -34,27 +34,31 @@ namespace { static char ID; // Pass ID, replacement for typeid ExternalFunctionsPassedConstants() : ModulePass(&ID) {} virtual bool runOnModule(Module &M) { - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->isDeclaration()) { - bool PrintedFn = false; - for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); - UI != E; ++UI) - if (Instruction *User = dyn_cast<Instruction>(*UI)) { - CallSite CS = CallSite::get(User); - if (CS.getInstruction()) { - for (CallSite::arg_iterator AI = CS.arg_begin(), - E = CS.arg_end(); AI != E; ++AI) - if (isa<Constant>(*AI)) { - if (!PrintedFn) { - errs() << "Function '" << I->getName() << "':\n"; - PrintedFn = true; - } - errs() << *User; - break; - } - } + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { + if (!I->isDeclaration()) continue; + + bool PrintedFn = false; + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); + UI != E; ++UI) { + Instruction *User = dyn_cast<Instruction>(*UI); + if (!User) continue; + + CallSite CS = CallSite::get(User); + if (!CS.getInstruction()) continue; + + for (CallSite::arg_iterator AI = CS.arg_begin(), + E = CS.arg_end(); AI != E; ++AI) { + if (!isa<Constant>(*AI)) continue; + + if (!PrintedFn) { + errs() << "Function '" << I->getName() << "':\n"; + PrintedFn = true; } + errs() << *User; + break; + } } + } return false; } @@ -78,7 +82,7 @@ namespace { AU.addRequiredTransitive<CallGraph>(); } virtual bool runOnModule(Module &M) { - getAnalysis<CallGraph>().print(std::cerr, &M); + getAnalysis<CallGraph>().print(errs(), &M); return false; } }; |