19 #ifndef LLVM_SUPPORT_ALLOCATORBASE_H 20 #define LLVM_SUPPORT_ALLOCATORBASE_H 39 static_assert(
static_cast<void *(
AllocatorBase::*)(
size_t,
size_t)
>(
41 static_cast<void *(DerivedT::*)(
size_t,
size_t)
>(
43 "Class derives from AllocatorBase without implementing the " 44 "core Allocate(size_t, size_t) overload!");
46 return static_cast<DerivedT *>(
this)->Allocate(
Size, Alignment);
54 static_cast<void (
AllocatorBase::*)(
const void *,
size_t,
size_t)
>(
56 static_cast<void (DerivedT::*)(
const void *,
size_t,
size_t)
>(
57 &DerivedT::Deallocate),
58 "Class derives from AllocatorBase without implementing the " 59 "core Deallocate(void *) overload!");
61 return static_cast<DerivedT *>(
this)->Deallocate(Ptr,
Size, Alignment);
69 return static_cast<T *>(
Allocate(Num *
sizeof(
T),
alignof(
T)));
74 std::enable_if_t<!std::is_same<std::remove_cv_t<T>,
void>::value,
void>
76 Deallocate(static_cast<const void *>(Ptr), Num *
sizeof(
T),
alignof(
T));
103 #endif // LLVM_SUPPORT_ALLOCATORBASE_H This class represents lattice values for constants.
void * Allocate(size_t Size, size_t Alignment)
Allocate Size bytes of Alignment aligned memory.
This file defines counterparts of C library allocation functions defined in the namespace 'std'.
#define LLVM_ATTRIBUTE_RETURNS_NONNULL
void Deallocate(const void *Ptr, size_t Size, size_t Alignment)
std::enable_if_t<!std::is_same< std::remove_cv_t< T >, void >::value, void > Deallocate(T *Ptr, size_t Num=1)
Deallocate space for a sequence of objects without constructing them.
void deallocate_buffer(void *Ptr, size_t Size, size_t Alignment)
Deallocate a buffer of memory with the given size and alignment.
T * Allocate(size_t Num=1)
Allocate space for a sequence of objects without constructing them.
void Deallocate(const void *Ptr, size_t Size, size_t Alignment)
Deallocate Ptr to Size bytes of memory allocated by this allocator.
LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS void * allocate_buffer(size_t Size, size_t Alignment)
Allocate a buffer of memory with the given size and alignment.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * Allocate(size_t Size, size_t Alignment)
CRTP base class providing obvious overloads for the core Allocate() methods of LLVM-style allocators.