[llvm-commits] [llvm] r149308 - /llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h

Manuel Klimek klimek at google.com
Tue Jan 31 07:52:11 PST 2012


Hi Ted,

this change broke the cfe/tooling branch. See
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/135932.html
for a fix proposal.

Cheers,
/Manuel

On Tue, Jan 31, 2012 at 1:57 AM, Ted Kremenek <kremenek at apple.com> wrote:
> Author: kremenek
> Date: Mon Jan 30 18:57:04 2012
> New Revision: 149308
>
> URL: http://llvm.org/viewvc/llvm-project?rev=149308&view=rev
> Log:
> Use traits for IntrusiveRefCntPtr to determine how to increment/decrement a reference count.
>
> 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=149308&r1=149307&r2=149308&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h (original)
> +++ llvm/trunk/include/llvm/ADT/IntrusiveRefCntPtr.h Mon Jan 30 18:57:04 2012
> @@ -83,6 +83,12 @@
>     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 @@
>     }
>
>   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);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list