summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-01-31 00:57:04 +0000
committerTed Kremenek <kremenek@apple.com>2012-01-31 00:57:04 +0000
commitb8f570db7c505bb9b567eea850a9aa86ef1c73fa (patch)
treeea8f58f4f4ae618fa91e2034b1d7d0f7b185305e
parentf3cae5149072ae13e5667c511a5b97191f67bd30 (diff)
downloadbcm5719-llvm-b8f570db7c505bb9b567eea850a9aa86ef1c73fa.tar.gz
bcm5719-llvm-b8f570db7c505bb9b567eea850a9aa86ef1c73fa.zip
Use traits for IntrusiveRefCntPtr to determine how to increment/decrement a reference count.
llvm-svn: 149308
-rw-r--r--llvm/include/llvm/ADT/IntrusiveRefCntPtr.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
index 1d7e463aa1f..b5b7a5106de 100644
--- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
+++ b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h
@@ -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);
OpenPOWER on IntegriCloud