Fix a bug in BitVector.h. All assignment operations (except the usual

assignment operator) were returning a copy of the bit vector, instead of a
reference! This old semantics probably did not meet the expectations.
With this patch, chained assignments happen to the right object.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63012 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Roman Levenstein 2009-01-26 11:07:20 +00:00
parent c4b1abd81e
commit 8d8a0c36b7

View File

@ -286,7 +286,7 @@ public:
}
// Intersection, union, disjoint union.
BitVector operator&=(const BitVector &RHS) {
BitVector &operator&=(const BitVector &RHS) {
unsigned ThisWords = NumBitWords(size());
unsigned RHSWords = NumBitWords(RHS.size());
unsigned i;
@ -302,14 +302,14 @@ public:
return *this;
}
BitVector operator|=(const BitVector &RHS) {
BitVector &operator|=(const BitVector &RHS) {
assert(Size == RHS.Size && "Illegal operation!");
for (unsigned i = 0; i < NumBitWords(size()); ++i)
Bits[i] |= RHS.Bits[i];
return *this;
}
BitVector operator^=(const BitVector &RHS) {
BitVector &operator^=(const BitVector &RHS) {
assert(Size == RHS.Size && "Illegal operation!");
for (unsigned i = 0; i < NumBitWords(size()); ++i)
Bits[i] ^= RHS.Bits[i];