[llvm-commits] [llvm] r44174 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h
Daniel Berlin
dberlin at dberlin.org
Thu Nov 15 10:06:49 PST 2007
Author: dannyb
Date: Thu Nov 15 12:06:49 2007
New Revision: 44174
URL: http://llvm.org/viewvc/llvm-project?rev=44174&view=rev
Log:
Fix bugs in iterator invalidation
Modified:
llvm/trunk/include/llvm/ADT/SparseBitVector.h
Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=44174&r1=44173&r2=44174&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Thu Nov 15 12:06:49 2007
@@ -614,8 +614,10 @@
// Loop through, intersecting as we go, erasing elements when necessary.
while (Iter2 != RHS.Elements.end()) {
- if (Iter1 == Elements.end())
+ if (Iter1 == Elements.end()) {
+ CurrElementIter = Elements.begin();
return changed;
+ }
if (Iter1->index() > Iter2->index()) {
++Iter2;
@@ -654,8 +656,10 @@
// Loop through, intersecting as we go, erasing elements when necessary.
while (Iter2 != RHS.Elements.end()) {
- if (Iter1 == Elements.end())
+ if (Iter1 == Elements.end()) {
+ CurrElementIter = Elements.begin();
return changed;
+ }
if (Iter1->index() > Iter2->index()) {
++Iter2;
@@ -689,6 +693,7 @@
const SparseBitVector<ElementSize> &RHS2)
{
Elements.clear();
+ CurrElementIter = Elements.begin();
ElementListConstIter Iter1 = RHS1.Elements.begin();
ElementListConstIter Iter2 = RHS2.Elements.begin();
@@ -732,7 +737,6 @@
++Iter1;
}
- CurrElementIter = Elements.begin();
return;
}
More information about the llvm-commits
mailing list