From: Roman Levenstein Date: Mon, 26 Jan 2009 11:07:20 +0000 (+0000) Subject: Fix a bug in BitVector.h. All assignment operations (except the usual X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8d8a0c36b70dacc73baa47ff6e92e5e774338117;p=oota-llvm.git 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 --- diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h index d92605b8193..23fde26e142 100644 --- a/include/llvm/ADT/BitVector.h +++ b/include/llvm/ADT/BitVector.h @@ -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];