aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-08-28 21:34:56 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-08-28 21:34:56 +0000
commit9827c6e315f189e3e3097d8cf2a86dfbd17e49bf (patch)
treee520b02e21254dd88bf4ce9f6f29b3d9cacaa77b
parentd9151962df928c312e17c776b158199d6bf46b85 (diff)
Add copy and assignment operators for POIterator, and
static constructors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@387 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/CFG.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/llvm/CFG.h b/include/llvm/CFG.h
index 5228746f34..43ca8fb0a8 100644
--- a/include/llvm/CFG.h
+++ b/include/llvm/CFG.h
@@ -358,7 +358,8 @@ class POIterator : public std::forward_iterator<BBType, ptrdiff_t> {
void traverseChild() {
while (VisitStack.top().second != succ_end(VisitStack.top().first)) {
- BBType *BB = *VisitStack.top().second++;
+ BBType *BB = *VisitStack.top().second;
+ ++ VisitStack.top().second;
if (!Visited.count(BB)) { // If the block is not visited...
Visited.insert(BB);
VisitStack.push(make_pair(BB, succ_begin(BB)));
@@ -373,8 +374,16 @@ public:
VisitStack.push(make_pair(BB, succ_begin(BB)));
traverseChild();
}
+ inline POIterator(const _Self& x)
+ : Visited(x.Visited), VisitStack(x.VisitStack) {
+ }
+ inline POIterator& operator=(const _Self& x) {
+ Visited = x.Visited;
+ VisitStack = x.VisitStack;
+ return *this;
+ }
inline POIterator() { /* End is when stack is empty */ }
-
+
inline bool operator==(const _Self& x) const {
return VisitStack == x.VisitStack;
}
@@ -400,6 +409,10 @@ public:
inline _Self operator++(int) { // Postincrement
_Self tmp = *this; ++*this; return tmp;
}
+
+ // Provide default begin and end methods when nothing special is needed.
+ static inline _Self begin (BBType *BB) { return _Self(BB); }
+ static inline _Self end (BBType *BB) { return _Self(); }
};
inline po_iterator po_begin( Method *M) {