diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-11 16:42:06 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-11 16:42:06 +0000 |
commit | 30ac7df857cf2144dadde270075fefa7293365ee (patch) | |
tree | 6126c3d1351199c0594c47ef172608aa6cee3e71 /include | |
parent | d918b7e915230047a669661c649cbbb03490a442 (diff) | |
download | external_llvm-30ac7df857cf2144dadde270075fefa7293365ee.zip external_llvm-30ac7df857cf2144dadde270075fefa7293365ee.tar.gz external_llvm-30ac7df857cf2144dadde270075fefa7293365ee.tar.bz2 |
improvements for IntrusiveRefCntPtr, patch by Mikhail Glushenkov
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49538 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/IntrusiveRefCntPtr.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/llvm/ADT/IntrusiveRefCntPtr.h b/include/llvm/ADT/IntrusiveRefCntPtr.h index 4709d45..ad2138b 100644 --- a/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -121,6 +121,11 @@ namespace llvm { retain(); } + IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr& S) { + replace(S.getPtr()); + return *this; + } + template <class X> IntrusiveRefCntPtr& operator=(const IntrusiveRefCntPtr<X>& S) { replace(S.getPtr()); @@ -140,7 +145,7 @@ namespace llvm { T* getPtr() const { return Obj; } - typedef T * IntrusiveRefCntPtr::*unspecified_bool_type; + typedef T* (IntrusiveRefCntPtr::*unspecified_bool_type) () const; operator unspecified_bool_type() const { return Obj == 0 ? 0 : &IntrusiveRefCntPtr::getPtr; } @@ -156,7 +161,7 @@ namespace llvm { void release() { if (Obj) Obj->Release(); } void replace(T* S) { - this_type(S).swap(this); + this_type(S).swap(*this); } }; |