[PATCH] D21423: Fix BitVector move ctor/assignment.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 15 17:44:43 PDT 2016


eugenis created this revision.
eugenis added a reviewer: pcc.
eugenis added a subscriber: llvm-commits.
eugenis set the repository for this revision to rL LLVM.

Current implementation leaves the object in an invalid state.

Repository:
  rL LLVM

http://reviews.llvm.org/D21423

Files:
  include/llvm/ADT/BitVector.h

Index: include/llvm/ADT/BitVector.h
===================================================================
--- include/llvm/ADT/BitVector.h
+++ include/llvm/ADT/BitVector.h
@@ -105,6 +105,7 @@
   BitVector(BitVector &&RHS)
     : Bits(RHS.Bits), Size(RHS.Size), Capacity(RHS.Capacity) {
     RHS.Bits = nullptr;
+    RHS.Size = RHS.Capacity = 0;
   }
 
   ~BitVector() {
@@ -454,6 +455,7 @@
     Capacity = RHS.Capacity;
 
     RHS.Bits = nullptr;
+    RHS.Size = RHS.Capacity = 0;
 
     return *this;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21423.60938.patch
Type: text/x-patch
Size: 505 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160616/5d76e324/attachment.bin>


More information about the llvm-commits mailing list