Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/new is written in an unsupported language. File is not indexed.

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP_NEW
0011 #define _LIBCPP_NEW
0012 
0013 /*
0014     new synopsis
0015 
0016 namespace std
0017 {
0018 
0019 class bad_alloc
0020     : public exception
0021 {
0022 public:
0023     bad_alloc() noexcept;
0024     bad_alloc(const bad_alloc&) noexcept;
0025     bad_alloc& operator=(const bad_alloc&) noexcept;
0026     virtual const char* what() const noexcept;
0027 };
0028 
0029 class bad_array_new_length : public bad_alloc // C++14
0030 {
0031 public:
0032     bad_array_new_length() noexcept;
0033 };
0034 
0035 enum class align_val_t : size_t {}; // C++17
0036 
0037 struct destroying_delete_t { // C++20
0038   explicit destroying_delete_t() = default;
0039 };
0040 inline constexpr destroying_delete_t destroying_delete{}; // C++20
0041 
0042 struct nothrow_t { explicit nothrow_t() = default; };
0043 extern const nothrow_t nothrow;
0044 typedef void (*new_handler)();
0045 new_handler set_new_handler(new_handler new_p) noexcept;
0046 new_handler get_new_handler() noexcept;
0047 
0048 // 21.6.4, pointer optimization barrier
0049 template <class T> [[nodiscard]] constexpr T* launder(T* p) noexcept;   // C++17, nodiscard since C++20
0050 }  // std
0051 
0052 void* operator new(std::size_t size);                                   // replaceable, nodiscard in C++20
0053 void* operator new(std::size_t size, std::align_val_t alignment);       // replaceable, C++17, nodiscard in C++20
0054 void* operator new(std::size_t size, const std::nothrow_t&) noexcept;   // replaceable, nodiscard in C++20
0055 void* operator new(std::size_t size, std::align_val_t alignment,
0056                    const std::nothrow_t&) noexcept;                     // replaceable, C++17, nodiscard in C++20
0057 void  operator delete(void* ptr) noexcept;                              // replaceable
0058 void  operator delete(void* ptr, std::size_t size) noexcept;            // replaceable, C++14
0059 void  operator delete(void* ptr, std::align_val_t alignment) noexcept;  // replaceable, C++17
0060 void  operator delete(void* ptr, std::size_t size,
0061                       std::align_val_t alignment) noexcept;             // replaceable, C++17
0062 void  operator delete(void* ptr, const std::nothrow_t&) noexcept;       // replaceable
0063 void  operator delete(void* ptr, std:align_val_t alignment,
0064                       const std::nothrow_t&) noexcept;                  // replaceable, C++17
0065 
0066 void* operator new[](std::size_t size);                                 // replaceable, nodiscard in C++20
0067 void* operator new[](std::size_t size,
0068                      std::align_val_t alignment) noexcept;              // replaceable, C++17, nodiscard in C++20
0069 void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable, nodiscard in C++20
0070 void* operator new[](std::size_t size, std::align_val_t alignment,
0071                      const std::nothrow_t&) noexcept;                   // replaceable, C++17, nodiscard in C++20
0072 void  operator delete[](void* ptr) noexcept;                            // replaceable
0073 void  operator delete[](void* ptr, std::size_t size) noexcept;          // replaceable, C++14
0074 void  operator delete[](void* ptr,
0075                         std::align_val_t alignment) noexcept;           // replaceable, C++17
0076 void  operator delete[](void* ptr, std::size_t size,
0077                         std::align_val_t alignment) noexcept;           // replaceable, C++17
0078 void  operator delete[](void* ptr, const std::nothrow_t&) noexcept;     // replaceable
0079 void  operator delete[](void* ptr, std::align_val_t alignment,
0080                         const std::nothrow_t&) noexcept;                // replaceable, C++17
0081 
0082 void* operator new  (std::size_t size, void* ptr) noexcept;             // nodiscard in C++20, constexpr since C++26
0083 void* operator new[](std::size_t size, void* ptr) noexcept;             // nodiscard in C++20, constexpr since C++26
0084 void  operator delete  (void* ptr, void*) noexcept;
0085 void  operator delete[](void* ptr, void*) noexcept;
0086 
0087 */
0088 
0089 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0090 #  include <__cxx03/new>
0091 #else
0092 #  include <__config>
0093 #  include <__new/align_val_t.h>
0094 #  include <__new/allocate.h>
0095 #  include <__new/exceptions.h>
0096 #  include <__new/global_new_delete.h>
0097 #  include <__new/new_handler.h>
0098 #  include <__new/nothrow_t.h>
0099 #  include <__new/placement_new_delete.h>
0100 
0101 #  if _LIBCPP_STD_VER >= 17
0102 #    include <__new/interference_size.h>
0103 #    include <__new/launder.h>
0104 #  endif
0105 
0106 #  if _LIBCPP_STD_VER >= 20
0107 #    include <__new/destroying_delete_t.h>
0108 #  endif
0109 
0110 // feature-test macros
0111 #  include <version>
0112 
0113 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0114 #    pragma GCC system_header
0115 #  endif
0116 
0117 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0118 #    include <cstddef>
0119 #    include <cstdlib>
0120 #    include <type_traits>
0121 #  endif
0122 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0123 
0124 #endif // _LIBCPP_NEW