[llvm-commits] CVS: llvm/include/llvm/ADT/EquivalenceClasses.h
Chris Lattner
lattner at cs.uiuc.edu
Sat Mar 19 13:02:28 PST 2005
Changes in directory llvm/include/llvm/ADT:
EquivalenceClasses.h updated: 1.11 -> 1.12
---
Log message:
Two fixes for the copy ctor/operator=:
1. Make sure to clear() 'this' before adding elements to it
2. Make sure that the leaders of the RHS EC are the leaders of the LHS EC.
---
Diffs of the changes: (+7 -4)
EquivalenceClasses.h | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
Index: llvm/include/llvm/ADT/EquivalenceClasses.h
diff -u llvm/include/llvm/ADT/EquivalenceClasses.h:1.11 llvm/include/llvm/ADT/EquivalenceClasses.h:1.12
--- llvm/include/llvm/ADT/EquivalenceClasses.h:1.11 Sat Mar 19 14:42:43 2005
+++ llvm/include/llvm/ADT/EquivalenceClasses.h Sat Mar 19 15:02:12 2005
@@ -118,11 +118,14 @@
}
const EquivalenceClasses &operator=(const EquivalenceClasses &RHS) {
+ TheMapping.clear();
for (iterator I = RHS.begin(), E = RHS.end(); I != E; ++I)
- if (I->isLeader())
- insert(I->getData());
- else
- unionSets(I->getData(), *RHS.findLeader(I));
+ if (I->isLeader()) {
+ member_iterator MI = RHS.member_begin(I);
+ member_iterator LeaderIt = member_begin(insert(*MI));
+ for (++MI; MI != member_end(); ++MI)
+ unionSets(LeaderIt, member_begin(insert(*MI)));
+ }
return *this;
}
More information about the llvm-commits
mailing list