llvm-project/clang/test/OpenMP/need_device_ptr_kind_ast_print.cpp
Zahira Ammarguellat 2d78b1409e
[OpenMP][Clang] Parsing/Sema support for need_device_ptr(fb_nullify/fb_preserve). (#168905)
This patch adds parsing, semantic handling, and diagnostics for the
`OpenMP 6.1 fb_nullify` and` fb_preserve` fallback modifiers used with
the `need_device_ptr` map modifier.
2025-11-25 13:48:37 -05:00

25 lines
685 B
C++

// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=61 -ast-print %s \
// RUN: | FileCheck %s
// expected-no-diagnostics
void __attribute__((noinline)) device_impl(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_a(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_b(int *xp, int *&xpref, int n) {}
// CHECK-LABEL: int main()
int main() {
int x;
int *xp = &x;
host_entry_a(xp, xp, 1);
host_entry_b(xp, xp, 1);
return 0;
}