[llvm-commits] [llvm] r49538 - /llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
Chris Lattner
sabre at nondot.org
Fri Apr 11 09:42:06 PDT 2008
Author: lattner
Date: Fri Apr 11 11:42:06 2008
New Revision: 49538
URL: http://llvm.org/viewvc/llvm-project?rev=49538&view=rev
Log:
improvements for IntrusiveRefCntPtr, patch by Mikhail Glushenkov
Modified:
llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
Modified: llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h?rev=49538&r1=49537&r2=49538&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h (original)
+++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h Fri Apr 11 11:42:06 2008
@@ -121,6 +121,11 @@
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 @@
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 @@
void release() { if (Obj) Obj->Release(); }
void replace(T* S) {
- this_type(S).swap(this);
+ this_type(S).swap(*this);
}
};
More information about the llvm-commits
mailing list