Louis Dionne | 9bd9388 | 2021-11-17 16:25:01 -0500 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 2 | // |
Chandler Carruth | d201210 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 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 |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
Louis Dionne | bb8099a | 2022-12-02 13:45:49 -0800 | [diff] [blame] | 9 | #include <__memory/aligned_alloc.h> |
Arthur O'Dwyer | cf9bf39 | 2022-02-11 13:00:39 -0500 | [diff] [blame] | 10 | #include <new> |
Howard Hinnant | 155c2af | 2010-05-24 17:49:41 +0000 | [diff] [blame] | 11 | #include <stdlib.h> |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 12 | |
Weiming Zhao | b613db7 | 2017-09-19 23:18:03 +0000 | [diff] [blame] | 13 | #include "include/atomic_support.h" |
Howard Hinnant | c51e102 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 14 | |
Eric Fiselier | ec3a167 | 2017-02-10 08:57:35 +0000 | [diff] [blame] | 15 | #if defined(_LIBCPP_ABI_MICROSOFT) |
Louis Dionne | a810c33 | 2019-03-21 18:19:21 +0000 | [diff] [blame] | 16 | # if !defined(_LIBCPP_ABI_VCRUNTIME) |
| 17 | # include "support/runtime/new_handler_fallback.ipp" |
| 18 | # endif |
Eric Fiselier | ec3a167 | 2017-02-10 08:57:35 +0000 | [diff] [blame] | 19 | #elif defined(LIBCXX_BUILDING_LIBCXXABI) |
Louis Dionne | a810c33 | 2019-03-21 18:19:21 +0000 | [diff] [blame] | 20 | # include <cxxabi.h> |
Eric Fiselier | ec3a167 | 2017-02-10 08:57:35 +0000 | [diff] [blame] | 21 | #elif defined(LIBCXXRT) |
Louis Dionne | a810c33 | 2019-03-21 18:19:21 +0000 | [diff] [blame] | 22 | # include <cxxabi.h> |
Eric Fiselier | 0fbd44d | 2017-02-10 09:16:29 +0000 | [diff] [blame] | 23 | # include "support/runtime/new_handler_fallback.ipp" |
Louis Dionne | a810c33 | 2019-03-21 18:19:21 +0000 | [diff] [blame] | 24 | #elif defined(__GLIBCXX__) |
| 25 | // nothing to do |
Louis Dionne | 9fd1b09 | 2019-04-17 21:57:49 +0000 | [diff] [blame] | 26 | #else |
Louis Dionne | 549c055 | 2019-04-16 19:26:56 +0000 | [diff] [blame] | 27 | # include "support/runtime/new_handler_fallback.ipp" |
Eric Fiselier | 88d1171 | 2017-02-10 07:43:08 +0000 | [diff] [blame] | 28 | #endif |
Eric Fiselier | 4e5fccc | 2017-02-10 04:25:33 +0000 | [diff] [blame] | 29 | |
Eric Fiselier | ec3a167 | 2017-02-10 08:57:35 +0000 | [diff] [blame] | 30 | namespace std |
| 31 | { |
| 32 | |
Peter Collingbourne | dc00995 | 2013-10-06 22:13:16 +0000 | [diff] [blame] | 33 | #ifndef __GLIBCXX__ |
Thomas Anderson | 637a0ad | 2019-01-30 19:09:41 +0000 | [diff] [blame] | 34 | const nothrow_t nothrow{}; |
Eric Fiselier | ec3a167 | 2017-02-10 08:57:35 +0000 | [diff] [blame] | 35 | #endif |
| 36 | |
| 37 | #ifndef LIBSTDCXX |
| 38 | |
| 39 | void |
| 40 | __throw_bad_alloc() |
| 41 | { |
| 42 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 43 | throw bad_alloc(); |
| 44 | #else |
| 45 | _VSTD::abort(); |
| 46 | #endif |
| 47 | } |
| 48 | |
| 49 | #endif // !LIBSTDCXX |
| 50 | |
| 51 | } // std |
| 52 | |
Shoaib Meenai | cfd1960 | 2017-10-09 19:25:17 +0000 | [diff] [blame] | 53 | #if !defined(__GLIBCXX__) && \ |
Eric Fiselier | 85f6633 | 2019-03-05 01:57:01 +0000 | [diff] [blame] | 54 | !defined(_LIBCPP_ABI_VCRUNTIME) && \ |
Eric Fiselier | 95555c9 | 2017-03-02 19:35:33 +0000 | [diff] [blame] | 55 | !defined(_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS) |
Peter Collingbourne | dc00995 | 2013-10-06 22:13:16 +0000 | [diff] [blame] | 56 | |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 57 | // Implement all new and delete operators as weak definitions |
Eric Fiselier | cd4496b | 2015-08-20 05:23:16 +0000 | [diff] [blame] | 58 | // in this shared library, so that they can be overridden by programs |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 59 | // that define non-weak copies of the functions. |
| 60 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 61 | _LIBCPP_WEAK |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 62 | void * |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 63 | operator new(std::size_t size) _THROW_BAD_ALLOC |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 64 | { |
| 65 | if (size == 0) |
| 66 | size = 1; |
| 67 | void* p; |
Bruce Mitchener | 170d897 | 2020-11-24 12:53:53 -0500 | [diff] [blame] | 68 | while ((p = ::malloc(size)) == nullptr) |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 69 | { |
Howard Hinnant | 34468d4 | 2010-08-22 13:53:14 +0000 | [diff] [blame] | 70 | // If malloc fails and there is a new_handler, |
| 71 | // call it to try free up memory. |
Howard Hinnant | 8c65b45 | 2010-12-04 19:56:43 +0000 | [diff] [blame] | 72 | std::new_handler nh = std::get_new_handler(); |
Howard Hinnant | f64dfce | 2010-12-04 19:54:11 +0000 | [diff] [blame] | 73 | if (nh) |
| 74 | nh(); |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 75 | else |
Howard Hinnant | 72f7358 | 2010-08-11 17:04:31 +0000 | [diff] [blame] | 76 | #ifndef _LIBCPP_NO_EXCEPTIONS |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 77 | throw std::bad_alloc(); |
Howard Hinnant | 72f7358 | 2010-08-11 17:04:31 +0000 | [diff] [blame] | 78 | #else |
| 79 | break; |
| 80 | #endif |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 81 | } |
| 82 | return p; |
| 83 | } |
| 84 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 85 | _LIBCPP_WEAK |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 86 | void* |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 87 | operator new(size_t size, const std::nothrow_t&) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 88 | { |
Bruce Mitchener | 170d897 | 2020-11-24 12:53:53 -0500 | [diff] [blame] | 89 | void* p = nullptr; |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 90 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 91 | try |
| 92 | { |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 93 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 94 | p = ::operator new(size); |
| 95 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 96 | } |
| 97 | catch (...) |
| 98 | { |
| 99 | } |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 100 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 101 | return p; |
| 102 | } |
| 103 | |
| 104 | _LIBCPP_WEAK |
| 105 | void* |
| 106 | operator new[](size_t size) _THROW_BAD_ALLOC |
| 107 | { |
| 108 | return ::operator new(size); |
| 109 | } |
| 110 | |
| 111 | _LIBCPP_WEAK |
| 112 | void* |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 113 | operator new[](size_t size, const std::nothrow_t&) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 114 | { |
Bruce Mitchener | 170d897 | 2020-11-24 12:53:53 -0500 | [diff] [blame] | 115 | void* p = nullptr; |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 116 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 117 | try |
| 118 | { |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 119 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 120 | p = ::operator new[](size); |
| 121 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 122 | } |
| 123 | catch (...) |
| 124 | { |
| 125 | } |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 126 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 127 | return p; |
| 128 | } |
| 129 | |
| 130 | _LIBCPP_WEAK |
| 131 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 132 | operator delete(void* ptr) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 133 | { |
Louis Dionne | 5086948 | 2020-12-17 13:26:47 -0500 | [diff] [blame] | 134 | ::free(ptr); |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | _LIBCPP_WEAK |
| 138 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 139 | operator delete(void* ptr, const std::nothrow_t&) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 140 | { |
| 141 | ::operator delete(ptr); |
| 142 | } |
| 143 | |
| 144 | _LIBCPP_WEAK |
| 145 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 146 | operator delete(void* ptr, size_t) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 147 | { |
| 148 | ::operator delete(ptr); |
| 149 | } |
| 150 | |
| 151 | _LIBCPP_WEAK |
| 152 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 153 | operator delete[] (void* ptr) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 154 | { |
| 155 | ::operator delete(ptr); |
| 156 | } |
| 157 | |
| 158 | _LIBCPP_WEAK |
| 159 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 160 | operator delete[] (void* ptr, const std::nothrow_t&) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 161 | { |
| 162 | ::operator delete[](ptr); |
| 163 | } |
| 164 | |
| 165 | _LIBCPP_WEAK |
| 166 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 167 | operator delete[] (void* ptr, size_t) noexcept |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 168 | { |
| 169 | ::operator delete[](ptr); |
| 170 | } |
| 171 | |
Eric Fiselier | ff4c8a2 | 2018-10-11 00:17:24 +0000 | [diff] [blame] | 172 | #if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) |
Eric Fiselier | 44832fb | 2017-01-20 01:47:26 +0000 | [diff] [blame] | 173 | |
Eric Fiselier | 850652f | 2017-01-20 01:13:49 +0000 | [diff] [blame] | 174 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 175 | void * |
| 176 | operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC |
| 177 | { |
| 178 | if (size == 0) |
| 179 | size = 1; |
| 180 | if (static_cast<size_t>(alignment) < sizeof(void*)) |
| 181 | alignment = std::align_val_t(sizeof(void*)); |
Louis Dionne | a392217 | 2020-11-12 15:14:33 -0500 | [diff] [blame] | 182 | |
| 183 | // Try allocating memory. If allocation fails and there is a new_handler, |
| 184 | // call it to try free up memory, and try again until it succeeds, or until |
| 185 | // the new_handler decides to terminate. |
| 186 | // |
| 187 | // If allocation fails and there is no new_handler, we throw bad_alloc |
| 188 | // (or return nullptr if exceptions are disabled). |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 189 | void* p; |
Louis Dionne | a392217 | 2020-11-12 15:14:33 -0500 | [diff] [blame] | 190 | while ((p = std::__libcpp_aligned_alloc(static_cast<std::size_t>(alignment), size)) == nullptr) |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 191 | { |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 192 | std::new_handler nh = std::get_new_handler(); |
| 193 | if (nh) |
| 194 | nh(); |
| 195 | else { |
| 196 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 197 | throw std::bad_alloc(); |
| 198 | #else |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 199 | break; |
| 200 | #endif |
| 201 | } |
| 202 | } |
| 203 | return p; |
| 204 | } |
| 205 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 206 | _LIBCPP_WEAK |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 207 | void* |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 208 | operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 209 | { |
Bruce Mitchener | 170d897 | 2020-11-24 12:53:53 -0500 | [diff] [blame] | 210 | void* p = nullptr; |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 211 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 212 | try |
| 213 | { |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 214 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 215 | p = ::operator new(size, alignment); |
| 216 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 217 | } |
| 218 | catch (...) |
| 219 | { |
| 220 | } |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 221 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 222 | return p; |
| 223 | } |
| 224 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 225 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 226 | void* |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 227 | operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC |
| 228 | { |
| 229 | return ::operator new(size, alignment); |
| 230 | } |
| 231 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 232 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 233 | void* |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 234 | operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 235 | { |
Bruce Mitchener | 170d897 | 2020-11-24 12:53:53 -0500 | [diff] [blame] | 236 | void* p = nullptr; |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 237 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 238 | try |
| 239 | { |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 240 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 241 | p = ::operator new[](size, alignment); |
| 242 | #ifndef _LIBCPP_NO_EXCEPTIONS |
| 243 | } |
| 244 | catch (...) |
| 245 | { |
| 246 | } |
Louis Dionne | 2b1ceaa | 2021-04-20 12:03:32 -0400 | [diff] [blame] | 247 | #endif // _LIBCPP_NO_EXCEPTIONS |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 248 | return p; |
| 249 | } |
| 250 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 251 | _LIBCPP_WEAK |
Nick Kledzik | d1a61bb | 2010-05-14 20:19:37 +0000 | [diff] [blame] | 252 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 253 | operator delete(void* ptr, std::align_val_t) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 254 | { |
Louis Dionne | 5086948 | 2020-12-17 13:26:47 -0500 | [diff] [blame] | 255 | std::__libcpp_aligned_free(ptr); |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 256 | } |
| 257 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 258 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 259 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 260 | operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 261 | { |
| 262 | ::operator delete(ptr, alignment); |
| 263 | } |
| 264 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 265 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 266 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 267 | operator delete(void* ptr, size_t, std::align_val_t alignment) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 268 | { |
| 269 | ::operator delete(ptr, alignment); |
| 270 | } |
| 271 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 272 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 273 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 274 | operator delete[] (void* ptr, std::align_val_t alignment) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 275 | { |
| 276 | ::operator delete(ptr, alignment); |
| 277 | } |
| 278 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 279 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 280 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 281 | operator delete[] (void* ptr, std::align_val_t alignment, const std::nothrow_t&) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 282 | { |
| 283 | ::operator delete[](ptr, alignment); |
| 284 | } |
| 285 | |
Shoaib Meenai | 2d71db4 | 2016-11-16 22:18:10 +0000 | [diff] [blame] | 286 | _LIBCPP_WEAK |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 287 | void |
Louis Dionne | 65358e1 | 2021-03-01 12:09:45 -0500 | [diff] [blame] | 288 | operator delete[] (void* ptr, size_t, std::align_val_t alignment) noexcept |
Eric Fiselier | 162922f | 2016-10-14 06:46:30 +0000 | [diff] [blame] | 289 | { |
| 290 | ::operator delete[](ptr, alignment); |
| 291 | } |
| 292 | |
Eric Fiselier | ff4c8a2 | 2018-10-11 00:17:24 +0000 | [diff] [blame] | 293 | #endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION |
Eric Fiselier | 85f6633 | 2019-03-05 01:57:01 +0000 | [diff] [blame] | 294 | #endif // !__GLIBCXX__ && !_LIBCPP_ABI_VCRUNTIME && !_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS |