[llvm-commits] CVS: llvm/include/llvm/ADT/SetVector.h

Reid Spencer reid at x10sys.com
Sat Sep 11 13:38:35 PDT 2004



Changes in directory llvm/include/llvm/ADT:

SetVector.h updated: 1.7 -> 1.8
---
Log message:

Fix the replace method to assert if an item was erased from the set but not
found in the vector. Previously, it just ignored this condition.


---
Diffs of the changes:  (+2 -2)

Index: llvm/include/llvm/ADT/SetVector.h
diff -u llvm/include/llvm/ADT/SetVector.h:1.7 llvm/include/llvm/ADT/SetVector.h:1.8
--- llvm/include/llvm/ADT/SetVector.h:1.7	Fri Sep 10 23:25:58 2004
+++ llvm/include/llvm/ADT/SetVector.h	Sat Sep 11 15:38:25 2004
@@ -113,8 +113,8 @@
   void remove(const value_type& X) {
     if (0 < set_.erase(X)) {
       iterator I = find(vector_.begin(),vector_.end(),X);
-      if (I != vector_.end())
-        vector_.erase(I);
+      assert(I != vector_.end() && "Corrupted SetVector instances!");
+      vector_.erase(I);
     }
   }
 






More information about the llvm-commits mailing list