1 //===- MemAlloc.cpp - Memory allocation functions -------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Support/MemAlloc.h"
12 // These are out of line to have __cpp_aligned_new not affect ABI.
14 LLVM_ATTRIBUTE_RETURNS_NONNULL LLVM_ATTRIBUTE_RETURNS_NOALIAS
void *
15 llvm::allocate_buffer(size_t Size
, size_t Alignment
) {
16 return ::operator new(Size
17 #ifdef __cpp_aligned_new
19 std::align_val_t(Alignment
)
24 void llvm::deallocate_buffer(void *Ptr
, size_t Size
, size_t Alignment
) {
26 #ifdef __cpp_sized_deallocation
30 #ifdef __cpp_aligned_new
32 std::align_val_t(Alignment
)