From: Benjamin Kramer Date: Sun, 27 May 2012 20:46:04 +0000 (+0000) Subject: IntrusiveRefCntPtr: Use the same pattern as the other operator= overloads when using... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5acc40a0373ed183d944b4f165dbb0b6798d5a92;p=oota-llvm.git IntrusiveRefCntPtr: Use the same pattern as the other operator= overloads when using rvalue refs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157546 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h index 947ccc46a52..37018d95e60 100644 --- a/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -23,6 +23,7 @@ #include "llvm/Support/Casting.h" #include "llvm/Support/Compiler.h" +#include namespace llvm { @@ -146,15 +147,13 @@ namespace llvm { #if LLVM_USE_RVALUE_REFERENCES IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr&& S) { - Obj = S.Obj; - S.Obj = 0; + this_type(std::move(S)).swap(*this); return *this; } template IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr&& S) { - Obj = S.getPtr(); - S.Obj = 0; + this_type(std::move(S)).swap(*this); return *this; } #endif