|  | // -*- C++ -*- | 
|  | //===----------------------------------------------------------------------===// | 
|  | // | 
|  | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | 
|  | // See https://llvm.org/LICENSE.txt for license information. | 
|  | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | 
|  | // | 
|  | //===----------------------------------------------------------------------===// | 
|  |  | 
|  | #ifndef _LIBCPP_NEW | 
|  | #define _LIBCPP_NEW | 
|  |  | 
|  | /* | 
|  | new synopsis | 
|  |  | 
|  | namespace std | 
|  | { | 
|  |  | 
|  | class bad_alloc | 
|  | : public exception | 
|  | { | 
|  | public: | 
|  | bad_alloc() noexcept; | 
|  | bad_alloc(const bad_alloc&) noexcept; | 
|  | bad_alloc& operator=(const bad_alloc&) noexcept; | 
|  | virtual const char* what() const noexcept; | 
|  | }; | 
|  |  | 
|  | class bad_array_new_length : public bad_alloc // C++14 | 
|  | { | 
|  | public: | 
|  | bad_array_new_length() noexcept; | 
|  | }; | 
|  |  | 
|  | enum class align_val_t : size_t {}; // C++17 | 
|  |  | 
|  | struct destroying_delete_t { // C++20 | 
|  | explicit destroying_delete_t() = default; | 
|  | }; | 
|  | inline constexpr destroying_delete_t destroying_delete{}; // C++20 | 
|  |  | 
|  | struct nothrow_t { explicit nothrow_t() = default; }; | 
|  | extern const nothrow_t nothrow; | 
|  | typedef void (*new_handler)(); | 
|  | new_handler set_new_handler(new_handler new_p) noexcept; | 
|  | new_handler get_new_handler() noexcept; | 
|  |  | 
|  | // 21.6.4, pointer optimization barrier | 
|  | template <class T> [[nodiscard]] constexpr T* launder(T* p) noexcept;   // C++17, nodiscard since C++20 | 
|  | }  // std | 
|  |  | 
|  | void* operator new(std::size_t size);                                   // replaceable, nodiscard in C++20 | 
|  | void* operator new(std::size_t size, std::align_val_t alignment);       // replaceable, C++17, nodiscard in C++20 | 
|  | void* operator new(std::size_t size, const std::nothrow_t&) noexcept;   // replaceable, nodiscard in C++20 | 
|  | void* operator new(std::size_t size, std::align_val_t alignment, | 
|  | const std::nothrow_t&) noexcept;                     // replaceable, C++17, nodiscard in C++20 | 
|  | void  operator delete(void* ptr) noexcept;                              // replaceable | 
|  | void  operator delete(void* ptr, std::size_t size) noexcept;            // replaceable, C++14 | 
|  | void  operator delete(void* ptr, std::align_val_t alignment) noexcept;  // replaceable, C++17 | 
|  | void  operator delete(void* ptr, std::size_t size, | 
|  | std::align_val_t alignment) noexcept;             // replaceable, C++17 | 
|  | void  operator delete(void* ptr, const std::nothrow_t&) noexcept;       // replaceable | 
|  | void  operator delete(void* ptr, std:align_val_t alignment, | 
|  | const std::nothrow_t&) noexcept;                  // replaceable, C++17 | 
|  |  | 
|  | void* operator new[](std::size_t size);                                 // replaceable, nodiscard in C++20 | 
|  | void* operator new[](std::size_t size, | 
|  | std::align_val_t alignment) noexcept;              // replaceable, C++17, nodiscard in C++20 | 
|  | void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable, nodiscard in C++20 | 
|  | void* operator new[](std::size_t size, std::align_val_t alignment, | 
|  | const std::nothrow_t&) noexcept;                   // replaceable, C++17, nodiscard in C++20 | 
|  | void  operator delete[](void* ptr) noexcept;                            // replaceable | 
|  | void  operator delete[](void* ptr, std::size_t size) noexcept;          // replaceable, C++14 | 
|  | void  operator delete[](void* ptr, | 
|  | std::align_val_t alignment) noexcept;           // replaceable, C++17 | 
|  | void  operator delete[](void* ptr, std::size_t size, | 
|  | std::align_val_t alignment) noexcept;           // replaceable, C++17 | 
|  | void  operator delete[](void* ptr, const std::nothrow_t&) noexcept;     // replaceable | 
|  | void  operator delete[](void* ptr, std::align_val_t alignment, | 
|  | const std::nothrow_t&) noexcept;                // replaceable, C++17 | 
|  |  | 
|  | void* operator new  (std::size_t size, void* ptr) noexcept;             // nodiscard in C++20, constexpr since C++26 | 
|  | void* operator new[](std::size_t size, void* ptr) noexcept;             // nodiscard in C++20, constexpr since C++26 | 
|  | void  operator delete  (void* ptr, void*) noexcept; | 
|  | void  operator delete[](void* ptr, void*) noexcept; | 
|  |  | 
|  | */ | 
|  |  | 
|  | #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 
|  | #  include <__cxx03/new> | 
|  | #else | 
|  | #  include <__config> | 
|  | #  include <__new/align_val_t.h> | 
|  | #  include <__new/allocate.h> | 
|  | #  include <__new/exceptions.h> | 
|  | #  include <__new/global_new_delete.h> | 
|  | #  include <__new/new_handler.h> | 
|  | #  include <__new/nothrow_t.h> | 
|  | #  include <__new/placement_new_delete.h> | 
|  |  | 
|  | #  if _LIBCPP_STD_VER >= 17 | 
|  | #    include <__new/interference_size.h> | 
|  | #    include <__new/launder.h> | 
|  | #  endif | 
|  |  | 
|  | #  if _LIBCPP_STD_VER >= 20 | 
|  | #    include <__new/destroying_delete_t.h> | 
|  | #  endif | 
|  |  | 
|  | // feature-test macros | 
|  | #  include <version> | 
|  |  | 
|  | #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) | 
|  | #    pragma GCC system_header | 
|  | #  endif | 
|  |  | 
|  | #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 | 
|  | #    include <cstddef> | 
|  | #    include <cstdlib> | 
|  | #    include <type_traits> | 
|  | #  endif | 
|  | #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) | 
|  |  | 
|  | #endif // _LIBCPP_NEW |