llvm-project/clang/test/OpenMP/need_device_ptr_kind_messages.cpp
Zahira Ammarguellat 0689a598e6
[NFC] [OpenMP] Fix typo and add initializer to modifier. (#174784)
Fixed typo and added initialization of modifier.
2026-01-08 10:43:25 -05:00

27 lines
1.0 KiB
C++

// RUN: %clang_cc1 -verify=omp61 -fopenmp -fopenmp-version=61 %s
void __attribute__((noinline)) device_impl(int *xp, int *&xpref, int n) {}
#pragma omp declare variant(device_impl) \
adjust_args(need_device_ptr(foo) : xp, xpref) // omp61-error{{invalid argument for 'need_device_ptr' kind in 'adjust_args' clause; expected 'fb_nullify' or 'fb_preserve'}} // omp61-error{{expected 'match', 'adjust_args', or 'append_args' clause on 'omp declare variant' directive}}
void __attribute__((noinline)) host_entry_a(int *xp, int *&xpref, int n) {}
#pragma omp declare variant(device_impl) \
adjust_args(need_device_ptr(fb_nullify) : xp, xpref)
void __attribute__((noinline)) host_entry_b(int *xp, int *&xpref, int n) {}
#pragma omp declare variant(device_impl) \
adjust_args(need_device_ptr(fb_preserve) : xp, xpref)
void __attribute__((noinline)) host_entry_c(int *xp, int *&xpref, int n) {}
int main() {
int x;
int *xp = &x;
host_entry_a(xp, xp, 1);
host_entry_b(xp, xp, 1);
host_entry_c(xp, xp, 1);
return 0;
}