LLVM 19.0.0git
Public Member Functions | List of all members
llvm::AllocatorBase< DerivedT > Class Template Reference

CRTP base class providing obvious overloads for the core Allocate() methods of LLVM-style allocators. More...

#include "llvm/Support/AllocatorBase.h"

Inheritance diagram for llvm::AllocatorBase< DerivedT >:
Inheritance graph
[legend]

Public Member Functions

void * Allocate (size_t Size, size_t Alignment)
 Allocate Size bytes of Alignment aligned memory.
 
void Deallocate (const void *Ptr, size_t Size, size_t Alignment)
 Deallocate Ptr to Size bytes of memory allocated by this allocator.
 
template<typename T >
TAllocate (size_t Num=1)
 Allocate space for a sequence of objects without constructing them.
 
template<typename T >
std::enable_if_t<!std::is_same_v< std::remove_cv_t< T >, void >, void > Deallocate (T *Ptr, size_t Num=1)
 Deallocate space for a sequence of objects without constructing them.
 

Detailed Description

template<typename DerivedT>
class llvm::AllocatorBase< DerivedT >

CRTP base class providing obvious overloads for the core Allocate() methods of LLVM-style allocators.

This base class both documents the full public interface exposed by all LLVM-style allocators, and redirects all of the overloads to a single core set of methods which the derived class must define.

Definition at line 40 of file AllocatorBase.h.

Member Function Documentation

◆ Allocate() [1/2]

template<typename DerivedT >
template<typename T >
T * llvm::AllocatorBase< DerivedT >::Allocate ( size_t  Num = 1)
inline

Allocate space for a sequence of objects without constructing them.

Definition at line 75 of file AllocatorBase.h.

References llvm::AllocatorBase< DerivedT >::Allocate().

◆ Allocate() [2/2]

template<typename DerivedT >
void * llvm::AllocatorBase< DerivedT >::Allocate ( size_t  Size,
size_t  Alignment 
)
inline

Allocate Size bytes of Alignment aligned memory.

This method must be implemented by DerivedT.

Definition at line 44 of file AllocatorBase.h.

References llvm::AllocatorBase< DerivedT >::Allocate(), and Size.

Referenced by llvm::AllocatorBase< DerivedT >::Allocate().

◆ Deallocate() [1/2]

template<typename DerivedT >
void llvm::AllocatorBase< DerivedT >::Deallocate ( const void *  Ptr,
size_t  Size,
size_t  Alignment 
)
inline

Deallocate Ptr to Size bytes of memory allocated by this allocator.

Definition at line 58 of file AllocatorBase.h.

References llvm::AllocatorBase< DerivedT >::Deallocate(), Ptr, and Size.

Referenced by llvm::AllocatorBase< DerivedT >::Deallocate().

◆ Deallocate() [2/2]

template<typename DerivedT >
template<typename T >
std::enable_if_t<!std::is_same_v< std::remove_cv_t< T >, void >, void > llvm::AllocatorBase< DerivedT >::Deallocate ( T Ptr,
size_t  Num = 1 
)
inline

Deallocate space for a sequence of objects without constructing them.

Definition at line 82 of file AllocatorBase.h.

References llvm::AllocatorBase< DerivedT >::Deallocate(), and Ptr.


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