[llvm-commits] [llvm] r63012 - /llvm/trunk/include/llvm/ADT/BitVector.h

Roman Levenstein romix.llvm at googlemail.com
Mon Jan 26 03:07:29 PST 2009


Author: romix
Date: Mon Jan 26 05:07:20 2009
New Revision: 63012

URL: http://llvm.org/viewvc/llvm-project?rev=63012&view=rev
Log:
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.


Modified:
    llvm/trunk/include/llvm/ADT/BitVector.h

Modified: llvm/trunk/include/llvm/ADT/BitVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=63012&r1=63011&r2=63012&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/BitVector.h (original)
+++ llvm/trunk/include/llvm/ADT/BitVector.h Mon Jan 26 05:07:20 2009
@@ -286,7 +286,7 @@
   }
 
   // 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 @@
     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];





More information about the llvm-commits mailing list