66 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9//10// These shims implement symbols that are present in the system libc++ on Apple platforms11// but are not implemented in upstream libc++. This allows testing libc++ under a system12// library configuration, which requires the just-built libc++ to be ABI compatible with13// the system library it is replacing.14//15 16#include <cstddef>17#include <new>18 19namespace std { // purposefully not versioned, like align_val_t20enum 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