summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/ADT/IntrusiveRefCntPtr.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
index 947ccc46a52..37018d95e60 100644
--- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
+++ b/llvm/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
OpenPOWER on IntegriCloud