llvm-project/libcxx/include/__new/placement_new_delete.h
Louis Dionne 9474e09459
[libc++] Granularize the <new> header (#119270)
This disentangles the code which previously had a mix of many #ifdefs, a
non-versioned namespace and a versioned namespace. It also makes it
clearer which parts of <new> are implemented on Windows by including <new.h>.
2024-12-13 14:17:56 -05:00

35 lines
1.1 KiB
C++

//===----------------------------------------------------------------------===//
//
// 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 <new.h>
#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 void operator delete(void*, void*) _NOEXCEPT {}
inline _LIBCPP_HIDE_FROM_ABI void operator delete[](void*, void*) _NOEXCEPT {}
#endif
#endif // _LIBCPP___NEW_PLACEMENT_NEW_DELETE_H