56 #ifndef LLVM_ADT_INTRUSIVEREFCNTPTR_H 57 #define LLVM_ADT_INTRUSIVEREFCNTPTR_H 72 mutable unsigned RefCount = 0;
81 assert(RefCount > 0 &&
"Reference count is already zero.");
83 delete static_cast<const Derived *
>(
this);
89 mutable std::atomic<int> RefCount;
95 void Retain()
const { RefCount.fetch_add(1, std::memory_order_relaxed); }
98 int NewRefCount = RefCount.fetch_sub(1, std::memory_order_acq_rel) - 1;
99 assert(NewRefCount >= 0 &&
"Reference count was already zero.");
100 if (NewRefCount == 0)
101 delete static_cast<const Derived *
>(
this);
166 T *
get()
const {
return Obj; }
167 explicit operator bool()
const {
return Obj; }
196 template <
class T,
class U>
199 return A.
get() == B.
get();
202 template <
class T,
class U>
205 return A.
get() != B.
get();
208 template <
class T,
class U>
213 template <
class T,
class U>
218 template <
class T,
class U>
223 template <
class T,
class U>
270 #endif // LLVM_ADT_INTRUSIVEREFCNTPTR_H static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr< T > &Val)
This class represents lattice values for constants.
Class you can specialize to provide custom retain/release functionality for a type.
A CRTP mixin class that adds reference counting to a type.
RefCountedBase(const RefCountedBase &)
ThreadSafeRefCountedBase()
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static void release(T *obj)
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
static void retain(T *obj)
The virtual file system interface.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
A thread-safe version of RefCountedBase.
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)
IntrusiveRefCntPtr(IntrusiveRefCntPtr &&S)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
void resetWithoutRelease()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool operator==(uint64_t V1, const APInt &V2)
IntrusiveRefCntPtr & operator=(IntrusiveRefCntPtr S)
IntrusiveRefCntPtr(IntrusiveRefCntPtr< X > &&S)