summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/CallGraph.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-06-26 17:27:42 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-06-26 17:27:42 +0000
commitaa2091505f6de0ababf8a6ec54e8a26c8b0be2be (patch)
tree124f3edf32b0d056358b0d313f04fee8feb2d1cb /llvm/lib/Analysis/CallGraph.cpp
parentd8db1e172cf320490c273380b847690007247b11 (diff)
downloadbcm5719-llvm-aa2091505f6de0ababf8a6ec54e8a26c8b0be2be.tar.gz
bcm5719-llvm-aa2091505f6de0ababf8a6ec54e8a26c8b0be2be.zip
Apply clang-tidy's modernize-loop-convert to lib/Analysis.
Only minor manual fixes. No functionality change intended. llvm-svn: 273816
Diffstat (limited to 'llvm/lib/Analysis/CallGraph.cpp')
-rw-r--r--llvm/lib/Analysis/CallGraph.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Analysis/CallGraph.cpp b/llvm/lib/Analysis/CallGraph.cpp
index 7d9252f746d..39cb86d2ccb 100644
--- a/llvm/lib/Analysis/CallGraph.cpp
+++ b/llvm/lib/Analysis/CallGraph.cpp
@@ -80,11 +80,9 @@ void CallGraph::addToCallGraph(Function *F) {
Node->addCalledFunction(CallSite(), CallsExternalNode.get());
// Look for calls by this function.
- for (Function::iterator BB = F->begin(), BBE = F->end(); BB != BBE; ++BB)
- for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;
- ++II) {
- CallSite CS(cast<Value>(II));
- if (CS) {
+ for (BasicBlock &BB : *F)
+ for (Instruction &I : BB) {
+ if (auto CS = CallSite(&I)) {
const Function *Callee = CS.getCalledFunction();
if (!Callee || !Intrinsic::isLeaf(Callee->getIntrinsicID()))
// Indirect calls of intrinsics are not allowed so no need to check.
@@ -111,8 +109,8 @@ void CallGraph::print(raw_ostream &OS) const {
SmallVector<CallGraphNode *, 16> Nodes;
Nodes.reserve(FunctionMap.size());
- for (auto I = begin(), E = end(); I != E; ++I)
- Nodes.push_back(I->second.get());
+ for (const auto &I : *this)
+ Nodes.push_back(I.second.get());
std::sort(Nodes.begin(), Nodes.end(),
[](CallGraphNode *LHS, CallGraphNode *RHS) {
@@ -186,9 +184,9 @@ void CallGraphNode::print(raw_ostream &OS) const {
OS << "<<" << this << ">> #uses=" << getNumReferences() << '\n';
- for (const_iterator I = begin(), E = end(); I != E; ++I) {
- OS << " CS<" << I->first << "> calls ";
- if (Function *FI = I->second->getFunction())
+ for (const auto &I : *this) {
+ OS << " CS<" << I.first << "> calls ";
+ if (Function *FI = I.second->getFunction())
OS << "function '" << FI->getName() <<"'\n";
else
OS << "external node\n";
OpenPOWER on IntegriCloud