improvements for IntrusiveRefCntPtr, patch by Mikhail Glushenkov
authorChris Lattner <sabre@nondot.org>
Fri, 11 Apr 2008 16:42:06 +0000 (16:42 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 11 Apr 2008 16:42:06 +0000 (16:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49538 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/IntrusiveRefCntPtr.h

index 4709d45b2a59c5007780b20fbeb2e3c7e7abcf6d..ad2138b10e098dd0ff66a87f1100f6785e8551e5 100644 (file)
@@ -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);
     }
   };