1 //===--------- new - OPENMP wrapper for <new> ------------------------------===
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
7 //===-----------------------------------------------------------------------===
9 #ifndef __CLANG_OPENMP_WRAPPERS_NEW
10 #define __CLANG_OPENMP_WRAPPERS_NEW
12 // We need the system <new> for the std::nothrow_t. The new/delete operators
13 // which do not use nothrow_t are provided without the <new> header.
16 #if defined(__NVPTX__) && defined(_OPENMP)
20 #pragma push_macro("OPENMP_NOEXCEPT")
21 #if __cplusplus >= 201103L
22 #define OPENMP_NOEXCEPT noexcept
24 #define OPENMP_NOEXCEPT
27 inline void *operator new(__SIZE_TYPE__ size,
28 const std::nothrow_t &) OPENMP_NOEXCEPT {
29 return ::operator new(size);
32 inline void *operator new[](__SIZE_TYPE__ size, const std::nothrow_t &) {
33 return ::operator new(size);
36 inline void operator delete(void *ptr, const std::nothrow_t &)OPENMP_NOEXCEPT {
37 ::operator delete(ptr);
40 inline void operator delete[](void *ptr,
41 const std::nothrow_t &) OPENMP_NOEXCEPT {
42 ::operator delete(ptr);
45 #pragma pop_macro("OPENMP_NOEXCEPT")
48 #endif // include guard