llvm.org GIT mirror llvm / 0004d86
Use traits for IntrusiveRefCntPtr to determine how to increment/decrement a reference count. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149308 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 8 years ago
1 changed file(s) with 8 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
8282 friend class IntrusiveRefCntPtr;
8383 };
8484
85
86 template struct IntrusiveRefCntPtrInfo {
87 static void retain(T *obj) { obj->Retain(); }
88 static void release(T *obj) { obj->Release(); }
89 };
90
8591 //===----------------------------------------------------------------------===//
8692 /// IntrusiveRefCntPtr - A template class that implements a "smart pointer"
8793 /// that assumes the wrapped object has a reference count associated
167173 }
168174
169175 private:
170 void retain() { if (Obj) Obj->Retain(); }
171 void release() { if (Obj) Obj->Release(); }
176 void retain() { if (Obj) IntrusiveRefCntPtrInfo::retain(Obj); }
177 void release() { if (Obj) IntrusiveRefCntPtrInfo::release(Obj); }
172178
173179 void replace(T* S) {
174180 this_type(S).swap(*this);