1//===--------- new - OPENMP wrapper for <new> ------------------------------=== 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#ifndef __CLANG_OPENMP_WRAPPERS_NEW 10#define __CLANG_OPENMP_WRAPPERS_NEW 11 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. 14#include_next <new> 15 16#if (defined(__NVPTX__) || defined(__AMDGPU__)) && defined(_OPENMP) 17 18#include <cstdlib> 19 20#pragma push_macro("OPENMP_NOEXCEPT") 21#if __cplusplus >= 201103L 22#define OPENMP_NOEXCEPT noexcept 23#else 24#define OPENMP_NOEXCEPT 25#endif 26 27inline void *operator new(__SIZE_TYPE__ size, 28 const std::nothrow_t &) OPENMP_NOEXCEPT { 29 return ::operator new(size); 30} 31 32inline void *operator new[](__SIZE_TYPE__ size, const std::nothrow_t &) { 33 return ::operator new(size); 34} 35 36inline void operator delete(void *ptr, const std::nothrow_t &)OPENMP_NOEXCEPT { 37 ::operator delete(ptr); 38} 39 40inline void operator delete[](void *ptr, 41 const std::nothrow_t &) OPENMP_NOEXCEPT { 42 ::operator delete(ptr); 43} 44 45#pragma pop_macro("OPENMP_NOEXCEPT") 46#endif 47 48#endif // include guard 49