LLVM 20.0.0git
Public Member Functions | List of all members
llvm::unique_function< R(P...)> Class Template Reference

#include "llvm/ADT/FunctionExtras.h"

Inheritance diagram for llvm::unique_function< R(P...)>:
Inheritance graph
[legend]

Public Member Functions

 unique_function ()=default
 
 unique_function (std::nullptr_t)
 
 unique_function (unique_function &&)=default
 
 unique_function (const unique_function &)=delete
 
unique_functionoperator= (unique_function &&)=default
 
unique_functionoperator= (const unique_function &)=delete
 
template<typename CallableT >
 unique_function (CallableT Callable, detail::EnableUnlessSameType< CallableT, unique_function > *=nullptr, detail::EnableIfCallable< CallableT, R, P... > *=nullptr)
 
operator() (P... Params)
 
- Public Member Functions inherited from llvm::detail::UniqueFunctionBase< R, P... >
 operator bool () const
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::detail::UniqueFunctionBase< R, P... >
NonTrivialCallbacks * getNonTrivialCallbacks () const
 
CallPtrT getCallPtr () const
 
void * getCalleePtr () const
 
void * getInlineStorage () const
 
void * getOutOfLineStorage () const
 
size_t getOutOfLineStorageSize () const
 
size_t getOutOfLineStorageAlignment () const
 
void setOutOfLineStorage (void *Ptr, size_t Size, size_t Alignment)
 
 UniqueFunctionBase (CallableT Callable, CalledAs< CalledAsT >)
 
 UniqueFunctionBase (UniqueFunctionBase &&RHS) noexcept
 
 UniqueFunctionBase ()=default
 
 ~UniqueFunctionBase ()
 
UniqueFunctionBaseoperator= (UniqueFunctionBase &&RHS) noexcept
 
- Static Protected Member Functions inherited from llvm::detail::UniqueFunctionBase< R, P... >
static R CallImpl (void *CallableAddr, AdjustedParamT< ParamTs >... Params)
 
static void MoveImpl (void *LHSCallableAddr, void *RHSCallableAddr) noexcept
 
static void DestroyImpl (void *CallableAddr) noexcept
 
- Protected Attributes inherited from llvm::detail::UniqueFunctionBase< R, P... >
struct IsSizeLessThanThresholdT< T, std::enable_if_t< sizeof(T)<=2 *sizeof(void *)> > :std::true_type {};template< typename T > struct AdjustedParamTBase { static_assert(!std::is_reference< T >::value, "references should be handled by template specialization");using type=std::conditional_t< std::is_trivially_copy_constructible< T >::value &&std::is_trivially_move_constructible< T >::value &&IsSizeLessThanThresholdT< T >::value, T, T & >;};template< typename T > struct AdjustedParamTBase< T & > { using type=T &;};template< typename T > struct AdjustedParamTBase< T && > { using type=T &;};template< typename T > using AdjustedParamT=typename AdjustedParamTBase< T >::type;using CallPtrT=R(*)(void *CallableAddr, AdjustedParamT< ParamTs >... Params);using MovePtrT=void(*)(void *LHSCallableAddr, void *RHSCallableAddr);using DestroyPtrT=void(*)(void *CallableAddr);struct alignas(8) TrivialCallback { CallPtrT CallPtr;};struct alignas(8) NonTrivialCallbacks { CallPtrT CallPtr;MovePtrT MovePtr;DestroyPtrT DestroyPtr;};using CallbackPointerUnionT=PointerUnion< TrivialCallback *, NonTrivialCallbacks * >;union StorageUnionT { struct OutOfLineStorageT { void *StoragePtr;size_t Size;size_t Alignment;} OutOfLineStorage;static_assert(sizeof(OutOfLineStorageT)<=InlineStorageSize, "Should always use all of the out-of-line storage for inline storage!");alignas(InlineStorageAlign) mutable std::byte InlineStorage[InlineStorageSize];} StorageUnion;PointerIntPair< CallbackPointerUnionT, 1, bool > CallbackAndInlineFlag;bool isInlineStorage() const { return CallbackAndInlineFlag.getInt();} bool isTrivialCallback() const { return isa< TrivialCallback * >(CallbackAndInlineFlag.getPointer());} CallPtrT getTrivialCallback() const { return cast< TrivialCallback * >(CallbackAndInlineFlag.getPointer()) -> CallPtr
 
- Static Protected Attributes inherited from llvm::detail::UniqueFunctionBase< R, P... >
static constexpr size_t InlineStorageSize
 
static constexpr size_t InlineStorageAlign
 

Detailed Description

template<typename R, typename... P>
class llvm::unique_function< R(P...)>

Definition at line 367 of file FunctionExtras.h.

Constructor & Destructor Documentation

◆ unique_function() [1/5]

template<typename R , typename... P>
llvm::unique_function< R(P...)>::unique_function ( )
default

◆ unique_function() [2/5]

template<typename R , typename... P>
llvm::unique_function< R(P...)>::unique_function ( std::nullptr_t  )
inline

Definition at line 372 of file FunctionExtras.h.

◆ unique_function() [3/5]

template<typename R , typename... P>
llvm::unique_function< R(P...)>::unique_function ( unique_function< R(P...)> &&  )
default

◆ unique_function() [4/5]

template<typename R , typename... P>
llvm::unique_function< R(P...)>::unique_function ( const unique_function< R(P...)> &  )
delete

◆ unique_function() [5/5]

template<typename R , typename... P>
template<typename CallableT >
llvm::unique_function< R(P...)>::unique_function ( CallableT  Callable,
detail::EnableUnlessSameType< CallableT, unique_function< R(P...)> > *  = nullptr,
detail::EnableIfCallable< CallableT, R, P... > *  = nullptr 
)
inline

Definition at line 379 of file FunctionExtras.h.

Member Function Documentation

◆ operator()()

template<typename R , typename... P>
R llvm::unique_function< R(P...)>::operator() ( P...  Params)
inline

Definition at line 386 of file FunctionExtras.h.

◆ operator=() [1/2]

template<typename R , typename... P>
unique_function & llvm::unique_function< R(P...)>::operator= ( const unique_function< R(P...)> &  )
delete

◆ operator=() [2/2]

template<typename R , typename... P>
unique_function & llvm::unique_function< R(P...)>::operator= ( unique_function< R(P...)> &&  )
default

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