summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-05-31 22:25:25 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-05-31 22:25:25 +0000
commit5168a72b2628288c5ba3143745554e2eadbb67b0 (patch)
tree9229636763440cd61ad53384ba90322d5e466a77
parent698daefb589c931073b6942f59516a1e1e6c2300 (diff)
downloadbcm5719-llvm-5168a72b2628288c5ba3143745554e2eadbb67b0.tar.gz
bcm5719-llvm-5168a72b2628288c5ba3143745554e2eadbb67b0.zip
IntrusiveRefCntPtr: Simplify operator= as suggested by Richard Smith.
This way the constructors do all the hard work. No intended functionality change. llvm-svn: 157773
-rw-r--r--llvm/include/llvm/ADT/IntrusiveRefCntPtr.h32
1 files changed, 2 insertions, 30 deletions
diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
index 37018d95e60..0c02a8f3185 100644
--- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
+++ b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
@@ -140,32 +140,8 @@ namespace llvm {
retain();
}
- IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr& S) {
- replace(S.getPtr());
- return *this;
- }
-
-#if LLVM_USE_RVALUE_REFERENCES
- IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr&& S) {
- this_type(std::move(S)).swap(*this);
- return *this;
- }
-
- template <class X>
- IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr<X>&& S) {
- this_type(std::move(S)).swap(*this);
- return *this;
- }
-#endif
-
- template <class X>
- IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr<X>& S) {
- replace(S.getPtr());
- return *this;
- }
-
- IntrusiveRefCntPtr& operator=(T * S) {
- replace(S);
+ IntrusiveRefCntPtr& operator=(IntrusiveRefCntPtr S) {
+ swap(S);
return *this;
}
@@ -200,10 +176,6 @@ namespace llvm {
private:
void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); }
void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); }
-
- void replace(T* S) {
- this_type(S).swap(*this);
- }
};
template<class T, class U>
OpenPOWER on IntegriCloud