15ffd83dbSDimitry Andric//===--------- new - OPENMP wrapper for <new> ------------------------------=== 25ffd83dbSDimitry Andric// 35ffd83dbSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 45ffd83dbSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 55ffd83dbSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65ffd83dbSDimitry Andric// 75ffd83dbSDimitry Andric//===-----------------------------------------------------------------------=== 85ffd83dbSDimitry Andric 95ffd83dbSDimitry Andric#ifndef __CLANG_OPENMP_WRAPPERS_NEW 105ffd83dbSDimitry Andric#define __CLANG_OPENMP_WRAPPERS_NEW 115ffd83dbSDimitry Andric 12fe6060f1SDimitry Andric// We need the system <new> for the std::nothrow_t. The new/delete operators 13fe6060f1SDimitry Andric// which do not use nothrow_t are provided without the <new> header. 145ffd83dbSDimitry Andric#include_next <new> 155ffd83dbSDimitry Andric 16*06c3fb27SDimitry Andric#if (defined(__NVPTX__) || defined(__AMDGPU__)) && defined(_OPENMP) 175ffd83dbSDimitry Andric 185ffd83dbSDimitry Andric#include <cstdlib> 195ffd83dbSDimitry Andric 205ffd83dbSDimitry Andric#pragma push_macro("OPENMP_NOEXCEPT") 215ffd83dbSDimitry Andric#if __cplusplus >= 201103L 225ffd83dbSDimitry Andric#define OPENMP_NOEXCEPT noexcept 235ffd83dbSDimitry Andric#else 245ffd83dbSDimitry Andric#define OPENMP_NOEXCEPT 255ffd83dbSDimitry Andric#endif 265ffd83dbSDimitry Andric 275ffd83dbSDimitry Andricinline void *operator new(__SIZE_TYPE__ size, 285ffd83dbSDimitry Andric const std::nothrow_t &) OPENMP_NOEXCEPT { 295ffd83dbSDimitry Andric return ::operator new(size); 305ffd83dbSDimitry Andric} 315ffd83dbSDimitry Andric 325ffd83dbSDimitry Andricinline void *operator new[](__SIZE_TYPE__ size, const std::nothrow_t &) { 335ffd83dbSDimitry Andric return ::operator new(size); 345ffd83dbSDimitry Andric} 355ffd83dbSDimitry Andric 365ffd83dbSDimitry Andricinline void operator delete(void *ptr, const std::nothrow_t &)OPENMP_NOEXCEPT { 375ffd83dbSDimitry Andric ::operator delete(ptr); 385ffd83dbSDimitry Andric} 395ffd83dbSDimitry Andric 405ffd83dbSDimitry Andricinline void operator delete[](void *ptr, 415ffd83dbSDimitry Andric const std::nothrow_t &) OPENMP_NOEXCEPT { 425ffd83dbSDimitry Andric ::operator delete(ptr); 435ffd83dbSDimitry Andric} 445ffd83dbSDimitry Andric 455ffd83dbSDimitry Andric#pragma pop_macro("OPENMP_NOEXCEPT") 465ffd83dbSDimitry Andric#endif 475ffd83dbSDimitry Andric 485ffd83dbSDimitry Andric#endif // include guard 49