21 #ifndef LLVM_ADT_INTRUSIVEREFCNTPTR_H
22 #define LLVM_ADT_INTRUSIVEREFCNTPTR_H
43 template <
class Derived>
45 mutable unsigned ref_cnt;
53 assert (ref_cnt > 0 &&
"Reference count is already zero.");
54 if (--ref_cnt == 0)
delete static_cast<const Derived*
>(
this);
67 mutable unsigned ref_cnt;
68 virtual void anchor();
78 assert (ref_cnt > 0 &&
"Reference count is already zero.");
79 if (--ref_cnt == 0)
delete this;
88 static void retain(
T *obj) { obj->Retain(); }
89 static void release(
T *obj) { obj->Release(); }
109 template <
typename T>
110 class IntrusiveRefCntPtr {
126 #if LLVM_HAS_RVALUE_REFERENCES
181 template<
class T,
class U>
185 return A.getPtr() == B.getPtr();
188 template<
class T,
class U>
192 return A.getPtr() != B.getPtr();
195 template<
class T,
class U>
199 return A.getPtr() == B;
202 template<
class T,
class U>
206 return A.getPtr() != B;
209 template<
class T,
class U>
213 return A == B.getPtr();
216 template<
class T,
class U>
220 return A != B.getPtr();
243 #endif // LLVM_ADT_INTRUSIVEREFCNTPTR_H
static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr< T > &Val)
RefCountedBase(const RefCountedBase &)
static void release(T *obj)
static void retain(T *obj)
IntrusiveRefCntPtr(const IntrusiveRefCntPtr &S)
bool operator!=(uint64_t V1, const APInt &V2)
IntrusiveRefCntPtr(T *obj)
void swap(IntrusiveRefCntPtr &other)
static SimpleType getSimplifiedValue(IntrusiveRefCntPtr< T > &Val)
IntrusiveRefCntPtr(const IntrusiveRefCntPtr< X > &S)
void resetWithoutRelease()
RefCountedBaseVPTR(const RefCountedBaseVPTR &)
virtual ~RefCountedBaseVPTR()
bool operator==(uint64_t V1, const APInt &V2)
IntrusiveRefCntPtr & operator=(IntrusiveRefCntPtr S)
T *(IntrusiveRefCntPtr::* unspecified_bool_type)() const