diff options
author | Dan Gohman <gohman@apple.com> | 2009-02-07 16:10:35 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-02-07 16:10:35 +0000 |
commit | f3ab3a937203d690744357844948faaf96fb73f9 (patch) | |
tree | dac9c0ea69a2785c71394fabe6dd6ccf7e9fa184 | |
parent | f996831427009c5abe37f0af9d9632ef60f181e2 (diff) |
Simplify some code by using blocks_begin(), blocks_end(), and
the iterator typedefs instead of handling the std::vector
directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64016 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/LoopInfo.h | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h index a1bac66390..0fa4abe056 100644 --- a/include/llvm/Analysis/LoopInfo.h +++ b/include/llvm/Analysis/LoopInfo.h @@ -98,7 +98,7 @@ public: /// contains - Return true if the specified basic block is in this loop /// bool contains(const BlockT *BB) const { - return std::find(Blocks.begin(), Blocks.end(), BB) != Blocks.end(); + return std::find(block_begin(), block_end(), BB) != block_end(); } /// iterator/begin/end - Return the loops contained entirely within this loop. @@ -173,8 +173,7 @@ public: std::sort(LoopBBs.begin(), LoopBBs.end()); typedef GraphTraits<BlockT*> BlockTraits; - for (typename std::vector<BlockT*>::const_iterator BI = Blocks.begin(), - BE = Blocks.end(); BI != BE; ++BI) + for (block_iterator BI = block_begin(), BE = block_end(); BI != BE; ++BI) for (typename BlockTraits::ChildIteratorType I = BlockTraits::child_begin(*BI), E = BlockTraits::child_end(*BI); I != E; ++I) @@ -195,8 +194,7 @@ public: std::sort(LoopBBs.begin(), LoopBBs.end()); typedef GraphTraits<BlockT*> BlockTraits; - for (typename std::vector<BlockT*>::const_iterator BI = Blocks.begin(), - BE = Blocks.end(); BI != BE; ++BI) + for (block_iterator BI = block_begin(), BE = block_end(); BI != BE; ++BI) for (typename BlockTraits::ChildIteratorType I = BlockTraits::child_begin(*BI), E = BlockTraits::child_end(*BI); I != E; ++I) @@ -217,8 +215,7 @@ public: std::vector<BlockT*> switchExitBlocks; - for (typename std::vector<BlockT*>::const_iterator BI = Blocks.begin(), - BE = Blocks.end(); BI != BE; ++BI) { + for (block_iterator BI = block_begin(), BE = block_end(); BI != BE; ++BI) { BlockT *current = *BI; switchExitBlocks.clear(); @@ -579,8 +576,7 @@ public: assert (getHeader() && "Loop header is missing"); assert (getLoopPreheader() && "Loop preheader is missing"); assert (getLoopLatch() && "Loop latch is missing"); - for (typename std::vector<LoopBase<BlockT>*>::const_iterator I = - SubLoops.begin(), E = SubLoops.end(); I != E; ++I) + for (iterator I = SubLoops.begin(), E = SubLoops.end(); I != E; ++I) (*I)->verifyLoop(); #endif } |