aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2002-12-06 15:02:22 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2002-12-06 15:02:22 +0000
commit1818275956b339de89ac57d90d37a88c3566048e (patch)
tree6474a29d0d8f8e7159db7456b6a50df31a14b751
parentd474e9cdce5aa061e9a340040246592737667cb5 (diff)
Bug fix in operator==() and in method fini().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4945 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/Support/SCCIterator.h9
-rw-r--r--include/llvm/ADT/SCCIterator.h9
2 files changed, 10 insertions, 8 deletions
diff --git a/include/Support/SCCIterator.h b/include/Support/SCCIterator.h
index 42d4bcb551..26afdd76e4 100644
--- a/include/Support/SCCIterator.h
+++ b/include/Support/SCCIterator.h
@@ -176,11 +176,12 @@ public:
// Direct loop termination test (I.fini() is more efficient than I == end())
inline bool fini() const {
- return VisitStack.empty();
+ assert(!CurrentSCC.empty() || VisitStack.empty());
+ return CurrentSCC.empty();
}
inline bool operator==(const _Self& x) const {
- return VisitStack == x.VisitStack;
+ return VisitStack == x.VisitStack && CurrentSCC == x.CurrentSCC;
}
inline bool operator!=(const _Self& x) const { return !operator==(x); }
@@ -195,11 +196,11 @@ public:
// Retrieve a pointer to the current SCC. Returns NULL when done.
inline const SccTy* operator*() const {
- assert(!CurrentSCC.empty() || fini());
+ assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC;
}
inline SccTy* operator*() {
- assert(!CurrentSCC.empty() || fini());
+ assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC;
}
};
diff --git a/include/llvm/ADT/SCCIterator.h b/include/llvm/ADT/SCCIterator.h
index 42d4bcb551..26afdd76e4 100644
--- a/include/llvm/ADT/SCCIterator.h
+++ b/include/llvm/ADT/SCCIterator.h
@@ -176,11 +176,12 @@ public:
// Direct loop termination test (I.fini() is more efficient than I == end())
inline bool fini() const {
- return VisitStack.empty();
+ assert(!CurrentSCC.empty() || VisitStack.empty());
+ return CurrentSCC.empty();
}
inline bool operator==(const _Self& x) const {
- return VisitStack == x.VisitStack;
+ return VisitStack == x.VisitStack && CurrentSCC == x.CurrentSCC;
}
inline bool operator!=(const _Self& x) const { return !operator==(x); }
@@ -195,11 +196,11 @@ public:
// Retrieve a pointer to the current SCC. Returns NULL when done.
inline const SccTy* operator*() const {
- assert(!CurrentSCC.empty() || fini());
+ assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC;
}
inline SccTy* operator*() {
- assert(!CurrentSCC.empty() || fini());
+ assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC;
}
};