[llvm-commits] CVS: llvm/include/Support/TarjanSCCIterator.h

Vikram Adve vadve at cs.uiuc.edu
Fri Dec 6 09:03:01 PST 2002


Changes in directory llvm/include/Support:

TarjanSCCIterator.h updated: 1.3 -> 1.4

---
Log message:

Bug fix in operator==() and in method fini().


---
Diffs of the changes:

Index: llvm/include/Support/TarjanSCCIterator.h
diff -u llvm/include/Support/TarjanSCCIterator.h:1.3 llvm/include/Support/TarjanSCCIterator.h:1.4
--- llvm/include/Support/TarjanSCCIterator.h:1.3	Fri Nov 15 12:04:16 2002
+++ llvm/include/Support/TarjanSCCIterator.h	Fri Dec  6 09:02:22 2002
@@ -176,11 +176,12 @@
 
   // 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 @@
 
   // 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;
   }
 };





More information about the llvm-commits mailing list