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
This commit is contained in:
Vikram S. Adve 2002-12-06 15:02:22 +00:00
parent d474e9cdce
commit 1818275956
2 changed files with 10 additions and 8 deletions

View File

@ -176,11 +176,12 @@ public:
// Direct loop termination test (I.fini() is more efficient than I == end()) // Direct loop termination test (I.fini() is more efficient than I == end())
inline bool fini() const { inline bool fini() const {
return VisitStack.empty(); assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty();
} }
inline bool operator==(const _Self& x) const { 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); } 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. // Retrieve a pointer to the current SCC. Returns NULL when done.
inline const SccTy* operator*() const { inline const SccTy* operator*() const {
assert(!CurrentSCC.empty() || fini()); assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC; return CurrentSCC.empty()? NULL : &CurrentSCC;
} }
inline SccTy* operator*() { inline SccTy* operator*() {
assert(!CurrentSCC.empty() || fini()); assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC; return CurrentSCC.empty()? NULL : &CurrentSCC;
} }
}; };

View File

@ -176,11 +176,12 @@ public:
// Direct loop termination test (I.fini() is more efficient than I == end()) // Direct loop termination test (I.fini() is more efficient than I == end())
inline bool fini() const { inline bool fini() const {
return VisitStack.empty(); assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty();
} }
inline bool operator==(const _Self& x) const { 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); } 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. // Retrieve a pointer to the current SCC. Returns NULL when done.
inline const SccTy* operator*() const { inline const SccTy* operator*() const {
assert(!CurrentSCC.empty() || fini()); assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC; return CurrentSCC.empty()? NULL : &CurrentSCC;
} }
inline SccTy* operator*() { inline SccTy* operator*() {
assert(!CurrentSCC.empty() || fini()); assert(!CurrentSCC.empty() || VisitStack.empty());
return CurrentSCC.empty()? NULL : &CurrentSCC; return CurrentSCC.empty()? NULL : &CurrentSCC;
} }
}; };