diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Headers/llvm_libc_wrappers/assert.h')
-rw-r--r-- | contrib/llvm-project/clang/lib/Headers/llvm_libc_wrappers/assert.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/contrib/llvm-project/clang/lib/Headers/llvm_libc_wrappers/assert.h b/contrib/llvm-project/clang/lib/Headers/llvm_libc_wrappers/assert.h new file mode 100644 index 000000000000..de650ca8442a --- /dev/null +++ b/contrib/llvm-project/clang/lib/Headers/llvm_libc_wrappers/assert.h @@ -0,0 +1,34 @@ +//===-- Wrapper for C standard assert.h declarations on the GPU ------------===// +// +// 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 __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__ +#define __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__ + +#if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__) +#error "This file is for GPU offloading compilation only" +#endif + +#include_next <assert.h> + +#if __has_include(<llvm-libc-decls/assert.h>) + +#if defined(__HIP__) || defined(__CUDA__) +#define __LIBC_ATTRS __attribute__((device)) +#endif + +#pragma omp begin declare target + +#include <llvm-libc-decls/assert.h> + +#pragma omp end declare target + +#undef __LIBC_ATTRS + +#endif + +#endif // __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__ |