mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-05 19:10:19 +00:00
Use traits for IntrusiveRefCntPtr to determine how to increment/decrement a reference count.
llvm-svn: 149308
This commit is contained in:
parent
92e817c1cc
commit
0022d6619e
@ -83,6 +83,12 @@ namespace llvm {
|
||||
friend class IntrusiveRefCntPtr;
|
||||
};
|
||||
|
||||
|
||||
template <typename T> struct IntrusiveRefCntPtrInfo {
|
||||
static void retain(T *obj) { obj->Retain(); }
|
||||
static void release(T *obj) { obj->Release(); }
|
||||
};
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
/// IntrusiveRefCntPtr - A template class that implements a "smart pointer"
|
||||
/// that assumes the wrapped object has a reference count associated
|
||||
@ -168,8 +174,8 @@ namespace llvm {
|
||||
}
|
||||
|
||||
private:
|
||||
void retain() { if (Obj) Obj->Retain(); }
|
||||
void release() { if (Obj) Obj->Release(); }
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user