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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // 10 // These shims implement symbols that are present in the system libc++ on Apple platforms 11 // but are not implemented in upstream libc++. This allows testing libc++ under a system 12 // library configuration, which requires the just-built libc++ to be ABI compatible with 13 // the system library it is replacing. 14 // 15 16 #include <cstddef> 17 #include <new> 18 19 namespace std { // purposefully not versioned, like align_val_t 20 enum class __type_descriptor_t : unsigned long long; 21 } 22 23 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::__type_descriptor_t) { 24 return ::operator new(__sz); 25 } 26 27 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t& __nt, 28 std::__type_descriptor_t) noexcept { 29 return ::operator new(__sz, __nt); 30 } 31 32 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::__type_descriptor_t) { 33 return ::operator new[](__sz); 34 } 35 36 _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t& __nt, 37 std::__type_descriptor_t) noexcept { 38 return ::operator new(__sz, __nt); 39 } 40 41 _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::__type_descriptor_t) noexcept { 42 return ::operator delete(__p); 43 } 44 45 _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t& __nt, 46 std::__type_descriptor_t) noexcept { 47 return ::operator delete(__p, __nt); 48 } 49 50 _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::__type_descriptor_t) noexcept { 51 return ::operator delete[](__p); 52 } 53 54 _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t& __nt, 55 std::__type_descriptor_t) noexcept { 56 return ::operator delete[](__p, __nt); 57 } 58 59 _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::__type_descriptor_t) noexcept { 60 return ::operator delete(__p, __sz); 61 } 62 63 _LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::__type_descriptor_t) noexcept { 64 return ::operator delete[](__p, __sz); 65 } 66