1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s 2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s 3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s 4 // expected-no-diagnostics 5 6 #ifndef HEADER 7 #define HEADER 8 9 void foo() {} 10 11 template <class T, class U> 12 T foo(T targ, U uarg) { 13 static T a; 14 U b; 15 int l; 16 #pragma omp target update to(a) if(l>5) device(l) nowait depend(inout:l) 17 18 #pragma omp target update from(b) if(l<5) device(l-1) nowait depend(inout:l) 19 return a + targ + (T)b; 20 } 21 // CHECK: static int a; 22 // CHECK-NEXT: float b; 23 // CHECK-NEXT: int l; 24 // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) 25 // CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) 26 // CHECK: static char a; 27 // CHECK-NEXT: float b; 28 // CHECK-NEXT: int l; 29 // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) 30 // CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) 31 // CHECK: static T a; 32 // CHECK-NEXT: U b; 33 // CHECK-NEXT: int l; 34 // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) 35 // CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) 36 37 int main(int argc, char **argv) { 38 static int a; 39 int n; 40 float f; 41 42 // CHECK: static int a; 43 // CHECK-NEXT: int n; 44 // CHECK-NEXT: float f; 45 #pragma omp target update to(a) if(f>0.0) device(n) nowait depend(in:n) 46 // CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) nowait depend(in : n) 47 #pragma omp target update from(f) if(f<0.0) device(n+1) nowait depend(in:n) 48 // CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) nowait depend(in : n) 49 return foo(argc, f) + foo(argv[0][0], f) + a; 50 } 51 52 #endif 53