aboutsummaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/need_device_ptr_kind_messages.cpp
blob: 9f3781b1d0420372c681db35b72c61a3032c1fa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// 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;
}