aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-05-27 20:46:04 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-05-27 20:46:04 +0000
commit5acc40a0373ed183d944b4f165dbb0b6798d5a92 (patch)
treed859f2bee16f8b6872e43cdcf191360cb1a2551e
parent55dc5c77a33bff5a902fec1b2133620064e1a256 (diff)
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
-rw-r--r--include/llvm/ADT/IntrusiveRefCntPtr.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h
index 947ccc46a5..37018d95e6 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 <memory>
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 <class X>
IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr<X>&& S) {
- Obj = S.getPtr();
- S.Obj = 0;
+ this_type(std::move(S)).swap(*this);
return *this;
}
#endif