From 3ad39e9878310e5317ee73c9b353c1e2c1c5c4ee Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sat, 11 Jul 2026 22:48:30 +0800 Subject: lib: establish Zircon libc++ and KTL foundation --- .../libcxx/include/c++/v1/__new/align_val_t.h | 35 ++++++++++ third_party/libcxx/include/c++/v1/__new/allocate.h | 78 +++++++++++++++++++++ .../include/c++/v1/__new/destroying_delete_t.h | 29 ++++++++ .../libcxx/include/c++/v1/__new/exceptions.h | 79 ++++++++++++++++++++++ .../include/c++/v1/__new/global_new_delete.h | 70 +++++++++++++++++++ .../include/c++/v1/__new/interference_size.h | 30 ++++++++ third_party/libcxx/include/c++/v1/__new/launder.h | 34 ++++++++++ .../libcxx/include/c++/v1/__new/new_handler.h | 28 ++++++++ .../libcxx/include/c++/v1/__new/nothrow_t.h | 29 ++++++++ .../include/c++/v1/__new/placement_new_delete.h | 34 ++++++++++ 10 files changed, 446 insertions(+) create mode 100644 third_party/libcxx/include/c++/v1/__new/align_val_t.h create mode 100644 third_party/libcxx/include/c++/v1/__new/allocate.h create mode 100644 third_party/libcxx/include/c++/v1/__new/destroying_delete_t.h create mode 100644 third_party/libcxx/include/c++/v1/__new/exceptions.h create mode 100644 third_party/libcxx/include/c++/v1/__new/global_new_delete.h create mode 100644 third_party/libcxx/include/c++/v1/__new/interference_size.h create mode 100644 third_party/libcxx/include/c++/v1/__new/launder.h create mode 100644 third_party/libcxx/include/c++/v1/__new/new_handler.h create mode 100644 third_party/libcxx/include/c++/v1/__new/nothrow_t.h create mode 100644 third_party/libcxx/include/c++/v1/__new/placement_new_delete.h (limited to 'third_party/libcxx/include/c++/v1/__new') diff --git a/third_party/libcxx/include/c++/v1/__new/align_val_t.h b/third_party/libcxx/include/c++/v1/__new/align_val_t.h new file mode 100644 index 0000000..d8ce528 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/align_val_t.h @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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_ALIGN_VAL_T_H +#define _LIBCPP___NEW_ALIGN_VAL_T_H + +#include <__config> +#include <__cstddef/size_t.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +// defines its own std::align_val_t type, +// which we use in order to be ABI-compatible with other STLs on Windows. +#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION && defined(_LIBCPP_ABI_VCRUNTIME) +# include +#endif + +_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD +#if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION && !defined(_LIBCPP_ABI_VCRUNTIME) +# ifndef _LIBCPP_CXX03_LANG +enum class align_val_t : size_t {}; +# else +enum align_val_t { __zero = 0, __max = (size_t)-1 }; +# endif +#endif +_LIBCPP_END_UNVERSIONED_NAMESPACE_STD + +#endif // _LIBCPP___NEW_ALIGN_VAL_T_H diff --git a/third_party/libcxx/include/c++/v1/__new/allocate.h b/third_party/libcxx/include/c++/v1/__new/allocate.h new file mode 100644 index 0000000..b9bc2e1 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/allocate.h @@ -0,0 +1,78 @@ +//===----------------------------------------------------------------------===// +// +// 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_ALLOCATE_H +#define _LIBCPP___NEW_ALLOCATE_H + +#include <__config> +#include <__cstddef/max_align_t.h> +#include <__cstddef/size_t.h> +#include <__new/align_val_t.h> +#include <__type_traits/type_identity.h> +#include <__utility/element_count.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI bool __is_overaligned_for_new(size_t __align) _NOEXCEPT { +#ifdef __STDCPP_DEFAULT_NEW_ALIGNMENT__ + return __align > __STDCPP_DEFAULT_NEW_ALIGNMENT__; +#else + return __align > _LIBCPP_ALIGNOF(max_align_t); +#endif +} + +template +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_CFI _Tp* +__libcpp_allocate(__element_count __n, [[__maybe_unused__]] size_t __align = _LIBCPP_ALIGNOF(_Tp)) { + size_t __size = static_cast(__n) * sizeof(_Tp); +#if _LIBCPP_HAS_ALIGNED_ALLOCATION + if (__is_overaligned_for_new(__align)) + return static_cast<_Tp*>(__builtin_operator_new(__size, static_cast(__align))); +#endif + + return static_cast<_Tp*>(__builtin_operator_new(__size)); +} + +#if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L +# define _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(...) __VA_ARGS__ +#else +# define _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(...) /* nothing */ +#endif + +template +inline _LIBCPP_HIDE_FROM_ABI void +__libcpp_deallocate(__type_identity_t<_Tp>* __ptr, + __element_count __n, + [[__maybe_unused__]] size_t __align = _LIBCPP_ALIGNOF(_Tp)) _NOEXCEPT { + [[__maybe_unused__]] size_t __size = static_cast(__n) * sizeof(_Tp); +#if _LIBCPP_HAS_ALIGNED_ALLOCATION + if (__is_overaligned_for_new(__align)) + return __builtin_operator_delete( + __ptr _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(, __size), static_cast(__align)); +#endif + return __builtin_operator_delete(__ptr _LIBCPP_ONLY_IF_SIZED_DEALLOCATION(, __size)); +} + +#undef _LIBCPP_ONLY_IF_SIZED_DEALLOCATION + +template +inline _LIBCPP_HIDE_FROM_ABI void __libcpp_deallocate_unsized( + __type_identity_t<_Tp>* __ptr, [[__maybe_unused__]] size_t __align = _LIBCPP_ALIGNOF(_Tp)) _NOEXCEPT { +#if _LIBCPP_HAS_ALIGNED_ALLOCATION + if (__is_overaligned_for_new(__align)) + return __builtin_operator_delete(__ptr, static_cast(__align)); +#endif + return __builtin_operator_delete(__ptr); +} +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NEW_ALLOCATE_H diff --git a/third_party/libcxx/include/c++/v1/__new/destroying_delete_t.h b/third_party/libcxx/include/c++/v1/__new/destroying_delete_t.h new file mode 100644 index 0000000..1d06d91 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/destroying_delete_t.h @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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_DESTROYING_DELETE_T_H +#define _LIBCPP___NEW_DESTROYING_DELETE_T_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if _LIBCPP_STD_VER >= 20 +_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD +// Enable the declaration even if the compiler doesn't support the language +// feature. +struct destroying_delete_t { + explicit destroying_delete_t() = default; +}; +inline constexpr destroying_delete_t destroying_delete{}; +_LIBCPP_END_UNVERSIONED_NAMESPACE_STD +#endif + +#endif // _LIBCPP___NEW_DESTROYING_DELETE_T_H diff --git a/third_party/libcxx/include/c++/v1/__new/exceptions.h b/third_party/libcxx/include/c++/v1/__new/exceptions.h new file mode 100644 index 0000000..1aadc23 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/exceptions.h @@ -0,0 +1,79 @@ +//===----------------------------------------------------------------------===// +// +// 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_EXCEPTIONS_H +#define _LIBCPP___NEW_EXCEPTIONS_H + +#include <__config> +#include <__exception/exception.h> +#include <__verbose_abort> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +// defines its own std::bad_alloc type, +// which we use in order to be ABI-compatible with other STLs on Windows. +#if defined(_LIBCPP_ABI_VCRUNTIME) +# include +#endif + +_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD +#if !defined(_LIBCPP_ABI_VCRUNTIME) + +class _LIBCPP_EXPORTED_FROM_ABI bad_alloc : public exception { +public: + bad_alloc() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI bad_alloc(const bad_alloc&) _NOEXCEPT = default; + _LIBCPP_HIDE_FROM_ABI bad_alloc& operator=(const bad_alloc&) _NOEXCEPT = default; + ~bad_alloc() _NOEXCEPT override; + [[__nodiscard__]] const char* what() const _NOEXCEPT override; +}; + +class _LIBCPP_EXPORTED_FROM_ABI bad_array_new_length : public bad_alloc { +public: + bad_array_new_length() _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI bad_array_new_length(const bad_array_new_length&) _NOEXCEPT = default; + _LIBCPP_HIDE_FROM_ABI bad_array_new_length& operator=(const bad_array_new_length&) _NOEXCEPT = default; + ~bad_array_new_length() _NOEXCEPT override; + [[__nodiscard__]] const char* what() const _NOEXCEPT override; +}; + +#elif defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 // !_LIBCPP_ABI_VCRUNTIME + +// When _HAS_EXCEPTIONS == 0, these complete definitions are needed, +// since they would normally be provided in vcruntime_exception.h +class bad_alloc : public exception { +public: + bad_alloc() noexcept : exception("bad allocation") {} + +private: + friend class bad_array_new_length; + + bad_alloc(char const* const __message) noexcept : exception(__message) {} +}; + +class bad_array_new_length : public bad_alloc { +public: + bad_array_new_length() noexcept : bad_alloc("bad array new length") {} +}; + +#endif // defined(_LIBCPP_ABI_VCRUNTIME) && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS == 0 + +[[__noreturn__]] _LIBCPP_EXPORTED_FROM_ABI void __throw_bad_alloc(); // not in C++ spec + +[[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_array_new_length() { +#if _LIBCPP_HAS_EXCEPTIONS + throw bad_array_new_length(); +#else + _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode"); +#endif +} +_LIBCPP_END_UNVERSIONED_NAMESPACE_STD + +#endif // _LIBCPP___NEW_EXCEPTIONS_H diff --git a/third_party/libcxx/include/c++/v1/__new/global_new_delete.h b/third_party/libcxx/include/c++/v1/__new/global_new_delete.h new file mode 100644 index 0000000..f31bac3 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/global_new_delete.h @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// 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_GLOBAL_NEW_DELETE_H +#define _LIBCPP___NEW_GLOBAL_NEW_DELETE_H + +#include <__config> +#include <__cstddef/size_t.h> +#include <__new/align_val_t.h> +#include <__new/nothrow_t.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if defined(_LIBCPP_CXX03_LANG) +# define _THROW_BAD_ALLOC throw(std::bad_alloc) +#else +# define _THROW_BAD_ALLOC +#endif + +#if defined(_LIBCPP_ABI_VCRUNTIME) +# include +#else +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC; +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT + _LIBCPP_NOALIAS; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; +# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT; +# endif + +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC; +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT + _LIBCPP_NOALIAS; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; +# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT; +# endif + +# if _LIBCPP_HAS_LIBRARY_ALIGNED_ALLOCATION +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* +operator new(std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; +# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; +# endif + +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* +operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC; +[[__nodiscard__]] _LIBCPP_OVERRIDABLE_FUNC_VIS void* +operator new[](std::size_t __sz, std::align_val_t, const std::nothrow_t&) _NOEXCEPT _LIBCPP_NOALIAS; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT; +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT; +# if defined(__cpp_sized_deallocation) && __cpp_sized_deallocation >= 201309L +_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT; +# endif +# endif +#endif + +#endif // _LIBCPP___NEW_GLOBAL_NEW_DELETE_H diff --git a/third_party/libcxx/include/c++/v1/__new/interference_size.h b/third_party/libcxx/include/c++/v1/__new/interference_size.h new file mode 100644 index 0000000..591d0ab --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/interference_size.h @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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_INTERFERENCE_SIZE_H +#define _LIBCPP___NEW_INTERFERENCE_SIZE_H + +#include <__config> +#include <__cstddef/size_t.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 + +inline constexpr size_t hardware_destructive_interference_size = __GCC_DESTRUCTIVE_SIZE; +inline constexpr size_t hardware_constructive_interference_size = __GCC_CONSTRUCTIVE_SIZE; + +#endif // _LIBCPP_STD_VER >= 17 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NEW_INTERFERENCE_SIZE_H diff --git a/third_party/libcxx/include/c++/v1/__new/launder.h b/third_party/libcxx/include/c++/v1/__new/launder.h new file mode 100644 index 0000000..886f614 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/launder.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_LAUNDER_H +#define _LIBCPP___NEW_LAUNDER_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD +template +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT { + // The compiler diagnoses misuses of __builtin_launder, so we don't need to add any static_asserts + // to implement the Mandates. + return __builtin_launder(__p); +} + +#if _LIBCPP_STD_VER >= 17 +template +[[nodiscard]] inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp* launder(_Tp* __p) noexcept { + return __builtin_launder(__p); +} +#endif +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___NEW_LAUNDER_H diff --git a/third_party/libcxx/include/c++/v1/__new/new_handler.h b/third_party/libcxx/include/c++/v1/__new/new_handler.h new file mode 100644 index 0000000..05f4e84 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/new_handler.h @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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_NEW_HANDLER_H +#define _LIBCPP___NEW_NEW_HANDLER_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if defined(_LIBCPP_ABI_VCRUNTIME) +# include +#else +_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD +typedef void (*new_handler)(); +_LIBCPP_EXPORTED_FROM_ABI new_handler set_new_handler(new_handler) _NOEXCEPT; +_LIBCPP_EXPORTED_FROM_ABI new_handler get_new_handler() _NOEXCEPT; +_LIBCPP_END_UNVERSIONED_NAMESPACE_STD +#endif // _LIBCPP_ABI_VCRUNTIME + +#endif // _LIBCPP___NEW_NEW_HANDLER_H diff --git a/third_party/libcxx/include/c++/v1/__new/nothrow_t.h b/third_party/libcxx/include/c++/v1/__new/nothrow_t.h new file mode 100644 index 0000000..a099772 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/nothrow_t.h @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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_NOTHROW_T_H +#define _LIBCPP___NEW_NOTHROW_T_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if defined(_LIBCPP_ABI_VCRUNTIME) +# include +#else +_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD +struct nothrow_t { + explicit nothrow_t() = default; +}; +extern _LIBCPP_EXPORTED_FROM_ABI const nothrow_t nothrow; +_LIBCPP_END_UNVERSIONED_NAMESPACE_STD +#endif // _LIBCPP_ABI_VCRUNTIME + +#endif // _LIBCPP___NEW_NOTHROW_T_H diff --git a/third_party/libcxx/include/c++/v1/__new/placement_new_delete.h b/third_party/libcxx/include/c++/v1/__new/placement_new_delete.h new file mode 100644 index 0000000..74692f3 --- /dev/null +++ b/third_party/libcxx/include/c++/v1/__new/placement_new_delete.h @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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_PLACEMENT_NEW_DELETE_H +#define _LIBCPP___NEW_PLACEMENT_NEW_DELETE_H + +#include <__config> +#include <__cstddef/size_t.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if defined(_LIBCPP_ABI_VCRUNTIME) +# include +#else +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void* +operator new(std::size_t, void* __p) _NOEXCEPT { + return __p; +} +[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void* +operator new[](std::size_t, void* __p) _NOEXCEPT { + return __p; +} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator delete(void*, void*) _NOEXCEPT {} +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void operator delete[](void*, void*) _NOEXCEPT {} +#endif + +#endif // _LIBCPP___NEW_PLACEMENT_NEW_DELETE_H -- cgit v1.2.3