From: Alp Toker Date: Sat, 5 Jul 2014 03:03:21 +0000 (+0000) Subject: Deprecate IntrusiveRefCntPtr::getPtr() in favour of get() X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b0c31a56e549d4633049fb4f4876e2876cb06911;p=platform%2Fupstream%2Fllvm.git Deprecate IntrusiveRefCntPtr::getPtr() in favour of get() This better aligns with other LLVM-specific and C++ standard library smart pointer types. In particular there are at least a few uses of intrusive refcounting in the frontend where it's worth investigating std::shared_ptr as a more appropriate alternative. llvm-svn: 212366 --- diff --git a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h index 128ada0..650b44c 100644 --- a/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h +++ b/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h @@ -154,13 +154,13 @@ public: } template - IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.getPtr()) { + IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.get()) { S.Obj = 0; } template IntrusiveRefCntPtr(const IntrusiveRefCntPtr& S) - : Obj(S.getPtr()) { + : Obj(S.get()) { retain(); } @@ -175,6 +175,9 @@ public: T* operator->() const { return Obj; } + T* get() const { return Obj; } + + /// Deprecated: use get(). T* getPtr() const { return Obj; } LLVM_EXPLICIT operator bool() const { return Obj; } @@ -203,42 +206,42 @@ public: inline bool operator==(const IntrusiveRefCntPtr& A, const IntrusiveRefCntPtr& B) { - return A.getPtr() == B.getPtr(); + return A.get() == B.get(); } template inline bool operator!=(const IntrusiveRefCntPtr& A, const IntrusiveRefCntPtr& B) { - return A.getPtr() != B.getPtr(); + return A.get() != B.get(); } template inline bool operator==(const IntrusiveRefCntPtr& A, U* B) { - return A.getPtr() == B; + return A.get() == B; } template inline bool operator!=(const IntrusiveRefCntPtr& A, U* B) { - return A.getPtr() != B; + return A.get() != B; } template inline bool operator==(T* A, const IntrusiveRefCntPtr& B) { - return A == B.getPtr(); + return A == B.get(); } template inline bool operator!=(T* A, const IntrusiveRefCntPtr& B) { - return A != B.getPtr(); + return A != B.get(); } template @@ -268,14 +271,14 @@ public: template struct simplify_type > { typedef T* SimpleType; static SimpleType getSimplifiedValue(IntrusiveRefCntPtr& Val) { - return Val.getPtr(); + return Val.get(); } }; template struct simplify_type > { typedef /*const*/ T* SimpleType; static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr& Val) { - return Val.getPtr(); + return Val.get(); } };