Fix a bug in BitVector.h. All assignment operations (except the usual
authorRoman Levenstein <romix.llvm@googlemail.com>
Mon, 26 Jan 2009 11:07:20 +0000 (11:07 +0000)
committerRoman Levenstein <romix.llvm@googlemail.com>
Mon, 26 Jan 2009 11:07:20 +0000 (11:07 +0000)
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

include/llvm/ADT/BitVector.h

index d92605b8193fcf01a1a5ff8c559f724d560c4bfe..23fde26e142ddfc1f88bcb0d26df2dc09a689435 100644 (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];