1 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -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 -std=c++11 -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
18 const int da
[5] = { 0 };
28 #pragma omp target teams is_device_ptr(k)
30 #pragma omp target teams is_device_ptr(z)
32 #pragma omp target teams is_device_ptr(aa) // OK
34 #pragma omp target teams is_device_ptr(raa) // OK
36 #pragma omp target teams is_device_ptr(g) // OK
38 #pragma omp target teams is_device_ptr(rg) // OK
40 #pragma omp target teams is_device_ptr(da) // OK
46 // CHECK-NEXT: const int da[5] = {0};
47 // CHECK-NEXT: ST g[10];
48 // CHECK-NEXT: STarr &rg = this->g;
50 // CHECK-NEXT: int &j = this->i;
51 // CHECK-NEXT: int *k = &this->j;
52 // CHECK-NEXT: int *&z = this->k;
53 // CHECK-NEXT: int aa[10];
54 // CHECK-NEXT: arr &raa = this->aa;
56 // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->k){{$}}
59 // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->z)
62 // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->aa)
65 // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->raa)
68 // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->g)
71 // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->rg)
74 // CHECK-NEXT: #pragma omp target teams is_device_ptr(this->da)
98 SC(SB
*&_RPtrS
) : RPtrS(_RPtrS
) {}
112 S2(S2
&s2
):a(s2
.a
) { }
114 static const float S2sc
;
116 const float S2::S2sc
= 0;
123 S3(S3
&s3
):a(s3
.a
) { }
138 S5(const S5
&s5
):a(s5
.a
) { }
144 #pragma omp threadprivate(h)
150 template <typename T
>
152 const T da
[5] = { 0 };
161 #pragma omp target teams is_device_ptr(k)
163 #pragma omp target teams is_device_ptr(z)
165 #pragma omp target teams is_device_ptr(aa)
167 #pragma omp target teams is_device_ptr(raa)
169 #pragma omp target teams is_device_ptr(h)
171 #pragma omp target teams is_device_ptr(rh)
173 #pragma omp target teams is_device_ptr(da)
178 // CHECK: template<> int tmain<int>(int argc) {
179 // CHECK-NEXT: const int da[5] = {0};
180 // CHECK-NEXT: S6 h[10];
181 // CHECK-NEXT: auto &rh = h;
182 // CHECK-NEXT: int i;
183 // CHECK-NEXT: int &j = i;
184 // CHECK-NEXT: int *k = &j;
185 // CHECK-NEXT: int *&z = k;
186 // CHECK-NEXT: int aa[10];
187 // CHECK-NEXT: auto &raa = aa;
188 // CHECK-NEXT: #pragma omp target teams is_device_ptr(k)
191 // CHECK-NEXT: #pragma omp target teams is_device_ptr(z)
194 // CHECK-NEXT: #pragma omp target teams is_device_ptr(aa)
197 // CHECK-NEXT: #pragma omp target teams is_device_ptr(raa)
200 // CHECK-NEXT: #pragma omp target teams is_device_ptr(h)
203 // CHECK-NEXT: #pragma omp target teams is_device_ptr(rh)
206 // CHECK-NEXT: #pragma omp target teams is_device_ptr(da)
208 // CHECK: template<> int *tmain<int *>(int *argc) {
209 // CHECK-NEXT: int *const da[5] = {0};
210 // CHECK-NEXT: S6 h[10];
211 // CHECK-NEXT: auto &rh = h;
212 // CHECK-NEXT: int *i;
213 // CHECK-NEXT: int *&j = i;
214 // CHECK-NEXT: int **k = &j;
215 // CHECK-NEXT: int **&z = k;
216 // CHECK-NEXT: int *aa[10];
217 // CHECK-NEXT: auto &raa = aa;
218 // CHECK-NEXT: #pragma omp target teams is_device_ptr(k)
221 // CHECK-NEXT: #pragma omp target teams is_device_ptr(z)
224 // CHECK-NEXT: #pragma omp target teams is_device_ptr(aa)
227 // CHECK-NEXT: #pragma omp target teams is_device_ptr(raa)
230 // CHECK-NEXT: #pragma omp target teams is_device_ptr(h)
233 // CHECK-NEXT: #pragma omp target teams is_device_ptr(rh)
236 // CHECK-NEXT: #pragma omp target teams is_device_ptr(da)
238 // CHECK-LABEL: int main(int argc, char **argv) {
239 int main(int argc
, char **argv
) {
240 const int da
[5] = { 0 };
249 // CHECK-NEXT: const int da[5] = {0};
250 // CHECK-NEXT: S6 h[10];
251 // CHECK-NEXT: auto &rh = h;
252 // CHECK-NEXT: int i;
253 // CHECK-NEXT: int &j = i;
254 // CHECK-NEXT: int *k = &j;
255 // CHECK-NEXT: int *&z = k;
256 // CHECK-NEXT: int aa[10];
257 // CHECK-NEXT: auto &raa = aa;
258 #pragma omp target teams is_device_ptr(k)
259 // CHECK-NEXT: #pragma omp target teams is_device_ptr(k)
263 #pragma omp target teams is_device_ptr(z)
264 // CHECK-NEXT: #pragma omp target teams is_device_ptr(z)
268 #pragma omp target teams is_device_ptr(aa)
269 // CHECK-NEXT: #pragma omp target teams is_device_ptr(aa)
273 #pragma omp target teams is_device_ptr(raa)
274 // CHECK-NEXT: #pragma omp target teams is_device_ptr(raa)
278 #pragma omp target teams is_device_ptr(h)
279 // CHECK-NEXT: #pragma omp target teams is_device_ptr(h)
283 #pragma omp target teams is_device_ptr(rh)
284 // CHECK-NEXT: #pragma omp target teams is_device_ptr(rh)
288 #pragma omp target teams is_device_ptr(da)
289 // CHECK-NEXT: #pragma omp target teams is_device_ptr(da)
293 return tmain
<int>(argc
) + *tmain
<int *>(&argc
);