78 lines · c
1//===----------------------------------------------------------------------===//2//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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef _LIBCPP___NEW_GLOBAL_NEW_DELETE_H10#define _LIBCPP___NEW_GLOBAL_NEW_DELETE_H11 12#include <__config>13#include <__cstddef/size_t.h>14#include <__new/align_val_t.h>15#include <__new/exceptions.h>16#include <__new/nothrow_t.h>17 18#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)19# pragma GCC system_header20#endif21 22#if defined(_LIBCPP_CXX03_LANG)23# define _THROW_BAD_ALLOC throw(std::bad_alloc)24#else25# define _THROW_BAD_ALLOC26#endif27 28#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L29# define _LIBCPP_HAS_SIZED_DEALLOCATION 130#else31# define _LIBCPP_HAS_SIZED_DEALLOCATION 032#endif33 34#if defined(_LIBCPP_ABI_VCRUNTIME)35# include <new.h>36#else37[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;38[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT39 _LIBCPP_NOALIAS;40_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;41_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;42# if _LIBCPP_HAS_SIZED_DEALLOCATION43_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;44# endif45 46[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;47[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT48 _LIBCPP_NOALIAS;49_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;50_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;51# if _LIBCPP_HAS_SIZED_DEALLOCATION52_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;53# endif54 55# if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION56[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;57[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void*58operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;59_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;60_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;61# if _LIBCPP_HAS_SIZED_DEALLOCATION62_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;63# endif64 65[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void*66operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;67[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void*68operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;69_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;70_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;71# if _LIBCPP_HAS_SIZED_DEALLOCATION72_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;73# endif74# endif75#endif76 77#endif // _LIBCPP___NEW_GLOBAL_NEW_DELETE_H78