Debian Codegraph @

clang/lib/Headers/llvm_libc_wrappers/assert.h

raw
1 //===-- Wrapper for C standard assert.h declarations on the GPU -*- C++ -*-===//
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_LLVM_LIBC_WRAPPERS_ASSERT_H__
10 #define __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__
11
12 #if !defined(_OPENMP) && !defined(__HIP__) && !defined(__CUDA__)
13 #error "This file is for GPU offloading compilation only"
14 #endif
15
16 #include_next <assert.h>
17
18 #if __has_include(<llvm-libc-decls/assert.h>)
19
20 #if defined(__HIP__) || defined(__CUDA__)
21 #define __LIBC_ATTRS __attribute__((device))
22 #else
23 #define __LIBC_ATTRS
24 #endif
25
26 // TODO: Define these for CUDA / HIP.
27
28 #undef __LIBC_ATTRS
29
30 #endif
31
32 #endif // __CLANG_LLVM_LIBC_WRAPPERS_ASSERT_H__