[PATCH] D32116: [APInt] Remove self move check from move assignment operator

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 11:05:51 PDT 2017


craig.topper added inline comments.


================
Comment at: include/llvm/ADT/APInt.h:681
   /// @brief Move assignment operator.
   APInt &operator=(APInt &&that) {
+    if (!isSingleWord())
----------------
hans wrote:
> Should we assert that this != &that ?
I'll add that.


================
Comment at: include/llvm/ADT/APInt.h:690
+    BitWidth = that.BitWidth;
     that.BitWidth = 0;
 
----------------
hans wrote:
> This isn't strictly necessary right, just for finding bugs? Maybe we should only do it for asserts builds?
Setting the bitwidth of 'that' to 0 is needed so 'that' doesn't try to delete the pVal array in its destructor.


https://reviews.llvm.org/D32116





More information about the llvm-commits mailing list