LLVM 19.0.0git
Static Public Member Functions | List of all members
llvm::IntrusiveRefCntPtrInfo< T > Struct Template Reference

Class you can specialize to provide custom retain/release functionality for a type. More...

#include "llvm/ADT/IntrusiveRefCntPtr.h"

Static Public Member Functions

static unsigned useCount (const T *obj)
 
static void retain (T *obj)
 
static void release (T *obj)
 

Detailed Description

template<typename T>
struct llvm::IntrusiveRefCntPtrInfo< T >

Class you can specialize to provide custom retain/release functionality for a type.

Usually specializing this class is not necessary, as IntrusiveRefCntPtr works with any type which defines Retain() and Release() functions – you can define those functions yourself if RefCountedBase doesn't work for you.

One case when you might want to specialize this type is if you have

Because Foo.h includes Bar.h, Bar.h can't include Foo.h in order to pull in the declaration of Foo. Without the declaration of Foo, normally Bar.h wouldn't be able to use IntrusiveRefCntPtr<Foo>, which wants to call T::Retain and T::Release.

To resolve this, Bar.h could include a third header, FooFwd.h, which forward-declares Foo and specializes IntrusiveRefCntPtrInfo<Foo>. Then Bar.h could use IntrusiveRefCntPtr<Foo>, although it still couldn't call any functions on Foo itself, because Foo would be an incomplete type.

Definition at line 161 of file IntrusiveRefCntPtr.h.

Member Function Documentation

◆ release()

template<typename T >
static void llvm::IntrusiveRefCntPtrInfo< T >::release ( T obj)
inlinestatic

Definition at line 164 of file IntrusiveRefCntPtr.h.

◆ retain()

template<typename T >
static void llvm::IntrusiveRefCntPtrInfo< T >::retain ( T obj)
inlinestatic

Definition at line 163 of file IntrusiveRefCntPtr.h.

◆ useCount()

template<typename T >
static unsigned llvm::IntrusiveRefCntPtrInfo< T >::useCount ( const T obj)
inlinestatic

Definition at line 162 of file IntrusiveRefCntPtr.h.

Referenced by llvm::IntrusiveRefCntPtr< T >::useCount().


The documentation for this struct was generated from the following file: