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 -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
13 // CHECK: namespace N1 {
24 // CHECK: class vecchild : public vec {
25 class vecchild
: public vec
{
31 #pragma omp declare mapper(id: vec v) map(v.len)
32 // CHECK: #pragma omp declare mapper (id : vec v) map(tofrom: v.len){{$}}
46 #pragma omp declare mapper(id: N1::vec v) map(v.len)
47 #pragma omp declare mapper(id: datin v) map(v.in)
50 // CHECK: template <class T> class dat {
51 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len){{$}}
52 // CHECK: #pragma omp declare mapper (id : datin v) map(tofrom: v.in){{$}}
54 // CHECK: template<> class dat<double> {
55 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len){{$}}
56 // CHECK: #pragma omp declare mapper (id : datin v) map(tofrom: v.in){{$}}
60 #pragma omp declare mapper(default : N1::vec kk) map(kk.len) map(kk.data[0:N])
61 // CHECK: #pragma omp declare mapper (default : N1::vec kk) map(tofrom: kk.len) map(tofrom: kk.data[0:N]){{$}}
62 #pragma omp declare mapper(dat<double> d) map(to: d.d)
63 // CHECK: #pragma omp declare mapper (default : dat<double> d) map(to: d.d){{$}}
74 #pragma omp declare mapper(id: struct foodat v) map(v.a)
75 #pragma omp declare mapper(idd: struct foodatchild v) map(v.k)
76 #pragma omp declare mapper(id: N1::vec v) map(v.len)
78 #pragma omp declare mapper(id: N1::vec v) map(v.len)
81 #pragma omp target map(mapper(id) alloc: fd)
83 #pragma omp target map(mapper(idd) alloc: fd.b)
85 #pragma omp target update to(mapper(id): fd)
86 #pragma omp target update to(mapper(idd): fd.b)
87 #pragma omp target update from(mapper(id): fd)
88 #pragma omp target update from(mapper(idd): fd.b)
92 // CHECK: template <typename T> T foo(T a) {
93 // CHECK: #pragma omp declare mapper (id : struct foodat v) map(tofrom: v.a)
94 // CHECK: #pragma omp declare mapper (idd : struct foodatchild v) map(tofrom: v.k)
95 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len)
97 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len)
99 // CHECK: #pragma omp target map(mapper(id),alloc: fd)
100 // CHECK: #pragma omp target map(mapper(idd),alloc: fd.b)
101 // CHECK: #pragma omp target update to(mapper(id): fd)
102 // CHECK: #pragma omp target update to(mapper(idd): fd.b)
103 // CHECK: #pragma omp target update from(mapper(id): fd)
104 // CHECK: #pragma omp target update from(mapper(idd): fd.b)
106 // CHECK: template<> int foo<int>(int a) {
107 // CHECK: #pragma omp declare mapper (id : struct foodat v) map(tofrom: v.a)
108 // CHECK: #pragma omp declare mapper (idd : struct foodatchild v) map(tofrom: v.k)
109 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len)
111 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len)
113 // CHECK: #pragma omp target map(mapper(id),alloc: fd)
114 // CHECK: #pragma omp target map(mapper(idd),alloc: fd.b)
115 // CHECK: #pragma omp target update to(mapper(id): fd)
116 // CHECK: #pragma omp target update to(mapper(idd): fd.b)
117 // CHECK: #pragma omp target update from(mapper(id): fd)
118 // CHECK: #pragma omp target update from(mapper(idd): fd.b)
121 // CHECK: int main() {
126 #pragma omp target map(mapper(N1::id) tofrom: vv) map(mapper(dat<double>::id) alloc: vvv)
127 // CHECK: #pragma omp target map(mapper(N1::id),tofrom: vv) map(mapper(dat<double>::id),alloc: vvv)
129 #pragma omp target map(mapper(N1::id) tofrom: vc)
130 // CHECK: #pragma omp target map(mapper(N1::id),tofrom: vc)
132 #pragma omp target map(mapper(default) tofrom: dd)
133 // CHECK: #pragma omp target map(mapper(default),tofrom: dd)
136 #pragma omp target update to(mapper(N1::id) : vc)
137 // CHECK: #pragma omp target update to(mapper(N1::id): vc)
138 #pragma omp target update to(mapper(dat<double>::id): vvv)
139 // CHECK: #pragma omp target update to(mapper(dat<double>::id): vvv)
141 #pragma omp target update from(mapper(N1::id) : vc)
142 // CHECK: #pragma omp target update from(mapper(N1::id): vc)
143 #pragma omp target update from(mapper(dat<double>::id): vvv)
144 // CHECK: #pragma omp target update from(mapper(dat<double>::id): vvv)
146 #pragma omp declare mapper(id: N1::vec v) map(v.len)
147 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len)
149 #pragma omp declare mapper(id: N1::vec v) map(v.len)
150 // CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len)