Path: blob/main/contrib/llvm-project/libcxx/include/__new/global_new_delete.h
213766 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef _LIBCPP___NEW_GLOBAL_NEW_DELETE_H9#define _LIBCPP___NEW_GLOBAL_NEW_DELETE_H1011#include <__config>12#include <__cstddef/size_t.h>13#include <__new/align_val_t.h>14#include <__new/exceptions.h>15#include <__new/nothrow_t.h>1617#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)18# pragma GCC system_header19#endif2021#if defined(_LIBCPP_CXX03_LANG)22# define _THROW_BAD_ALLOC throw(std::bad_alloc)23#else24# define _THROW_BAD_ALLOC25#endif2627#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L28# define _LIBCPP_HAS_SIZED_DEALLOCATION 129#else30# define _LIBCPP_HAS_SIZED_DEALLOCATION 031#endif3233#if defined(_LIBCPP_ABI_VCRUNTIME)34# include <new.h>35#else36[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;37[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT38_LIBCPP_NOALIAS;39_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;40_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;41# if _LIBCPP_HAS_SIZED_DEALLOCATION42_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;43# endif4445[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;46[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT47_LIBCPP_NOALIAS;48_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;49_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;50# if _LIBCPP_HAS_SIZED_DEALLOCATION51_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;52# endif5354# if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION55[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;56[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void*57operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;58_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;59_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;60# if _LIBCPP_HAS_SIZED_DEALLOCATION61_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;62# endif6364[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void*65operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;66[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void*67operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS;68_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;69_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;70# if _LIBCPP_HAS_SIZED_DEALLOCATION71_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;72# endif73# endif74#endif7576#endif // _LIBCPP___NEW_GLOBAL_NEW_DELETE_H777879