RegisterCoalescer: Fix creating full / empty subrange on undef subreg use (#117936)
[llvm-project.git] / clang / test / SemaOpenACC / compute-construct-varlist-ast.cpp
blob1bfd4e8af64818def2b2198ee2a1d60e298dafc9
1 // RUN: %clang_cc1 %s -fopenacc -Wno-openacc-deprecated-clause-alias -ast-dump | FileCheck %s
3 // Test this with PCH.
4 // RUN: %clang_cc1 %s -fopenacc -emit-pch -Wno-openacc-deprecated-clause-alias -o %t %s
5 // RUN: %clang_cc1 %s -fopenacc -include-pch %t -Wno-openacc-deprecated-clause-alias -ast-dump-all | FileCheck %s
7 #ifndef PCH_HELPER
8 #define PCH_HELPER
10 int Global;
11 short GlobalArray[5];
13 void NormalUses(float *PointerParam) {
14 // CHECK: FunctionDecl{{.*}}NormalUses
15 // CHECK: ParmVarDecl
16 // CHECK-NEXT: CompoundStmt
18 #pragma acc parallel private(Global, GlobalArray[2])
19 while(true);
20 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
21 // CHECK-NEXT: private clause
22 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
23 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'short' lvalue
24 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'short *' <ArrayToPointerDecay>
25 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
26 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 2
27 // CHECK-NEXT: WhileStmt
28 // CHECK-NEXT: CXXBoolLiteralExpr
29 // CHECK-NEXT: NullStmt
31 #pragma acc parallel private(GlobalArray, PointerParam[Global])
32 while(true);
33 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
34 // CHECK-NEXT: private clause
35 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
36 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
37 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
38 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
39 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
40 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
41 // CHECK-NEXT: WhileStmt
42 // CHECK-NEXT: CXXBoolLiteralExpr
43 // CHECK-NEXT: NullStmt
45 #pragma acc parallel firstprivate(GlobalArray, PointerParam[Global])
46 while(true);
47 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
48 // CHECK-NEXT: firstprivate clause
49 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
50 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
51 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
52 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
53 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
54 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
55 // CHECK-NEXT: WhileStmt
56 // CHECK-NEXT: CXXBoolLiteralExpr
57 // CHECK-NEXT: NullStmt
59 #pragma acc parallel present(GlobalArray, PointerParam[Global])
60 while(true);
61 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
62 // CHECK-NEXT: present clause
63 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
64 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
65 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
66 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
67 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
68 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
69 // CHECK-NEXT: WhileStmt
70 // CHECK-NEXT: CXXBoolLiteralExpr
71 // CHECK-NEXT: NullStmt
73 #pragma acc parallel no_create(GlobalArray, PointerParam[Global])
74 while(true);
75 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
76 // CHECK-NEXT: no_create clause
77 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
78 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
79 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
80 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
81 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
82 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
83 // CHECK-NEXT: WhileStmt
84 // CHECK-NEXT: CXXBoolLiteralExpr
85 // CHECK-NEXT: NullStmt
87 #pragma acc parallel private(GlobalArray) private(PointerParam[Global])
88 while(true);
89 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
90 // CHECK-NEXT: private clause
91 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
92 // CHECK-NEXT: private clause
93 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
94 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
95 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
96 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
97 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
98 // CHECK-NEXT: WhileStmt
99 // CHECK-NEXT: CXXBoolLiteralExpr
100 // CHECK-NEXT: NullStmt
102 #pragma acc parallel copy(GlobalArray) pcopy(PointerParam[Global]) present_or_copy(Global)
103 while(true);
104 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
105 // CHECK-NEXT: copy clause
106 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
107 // CHECK-NEXT: pcopy clause
108 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
109 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
110 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
111 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
112 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
113 // CHECK-NEXT: present_or_copy clause
114 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
115 // CHECK-NEXT: WhileStmt
116 // CHECK-NEXT: CXXBoolLiteralExpr
117 // CHECK-NEXT: NullStmt
119 #pragma acc parallel copyin(GlobalArray) pcopyin(readonly: PointerParam[Global]) present_or_copyin(Global)
120 while(true);
121 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
122 // CHECK-NEXT: copyin clause
123 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
124 // CHECK-NEXT: pcopyin clause : readonly
125 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
126 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
127 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
128 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
129 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
130 // CHECK-NEXT: present_or_copyin clause
131 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
132 // CHECK-NEXT: WhileStmt
133 // CHECK-NEXT: CXXBoolLiteralExpr
134 // CHECK-NEXT: NullStmt
136 #pragma acc parallel copyout(GlobalArray) pcopyout(zero:PointerParam[Global]) present_or_copyout(Global)
137 while(true);
138 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
139 // CHECK-NEXT: copyout clause
140 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
141 // CHECK-NEXT: pcopyout clause : zero
142 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
143 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
144 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
145 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
146 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
147 // CHECK-NEXT: present_or_copyout clause
148 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
149 // CHECK-NEXT: WhileStmt
150 // CHECK-NEXT: CXXBoolLiteralExpr
151 // CHECK-NEXT: NullStmt
153 #pragma acc parallel create(GlobalArray) pcreate(zero:PointerParam[Global]) present_or_create(Global)
154 while(true);
155 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
156 // CHECK-NEXT: create clause
157 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
158 // CHECK-NEXT: pcreate clause : zero
159 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
160 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
161 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
162 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
163 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
164 // CHECK-NEXT: present_or_create clause
165 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
166 // CHECK-NEXT: WhileStmt
167 // CHECK-NEXT: CXXBoolLiteralExpr
168 // CHECK-NEXT: NullStmt
170 #pragma acc parallel private(GlobalArray, PointerParam[Global : Global])
171 while(true);
172 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
173 // CHECK-NEXT: private clause
174 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
175 // CHECK-NEXT: ArraySectionExpr
176 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
177 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}} 'PointerParam' 'float *'
178 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
179 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
180 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
181 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
182 // CHECK-NEXT: WhileStmt
183 // CHECK-NEXT: CXXBoolLiteralExpr
184 // CHECK-NEXT: NullStmt
186 #pragma acc parallel firstprivate(GlobalArray, PointerParam[Global : Global])
187 while(true);
188 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
189 // CHECK-NEXT: firstprivate clause
190 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
191 // CHECK-NEXT: ArraySectionExpr
192 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
193 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}} 'PointerParam' 'float *'
194 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
195 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
196 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
197 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
198 // CHECK-NEXT: WhileStmt
199 // CHECK-NEXT: CXXBoolLiteralExpr
200 // CHECK-NEXT: NullStmt
202 #pragma acc parallel attach(PointerParam) deviceptr(PointerParam)
203 while (true);
204 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
205 // CHECK-NEXT: attach clause
206 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}} 'PointerParam' 'float *'
207 // CHECK-NEXT: deviceptr clause
208 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}} 'PointerParam' 'float *'
209 // CHECK-NEXT: WhileStmt
210 // CHECK-NEXT: CXXBoolLiteralExpr
211 // CHECK-NEXT: NullStmt
214 // This example is an error typically, but we want to make sure we're properly
215 // capturing NTTPs until instantiation time.
216 template<unsigned I>
217 void UnInstTempl() {
218 // CHECK-NEXT: FunctionTemplateDecl{{.*}} UnInstTempl
219 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}}referenced 'unsigned int' depth 0 index 0 I
220 // CHECK-NEXT: FunctionDecl{{.*}} UnInstTempl 'void ()'
221 // CHECK-NEXT: CompoundStmt
222 #pragma acc parallel private(I)
223 while(true);
224 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
225 // CHECK-NEXT: private clause
226 // CHECK-NEXT: DeclRefExpr{{.*}}'unsigned int' NonTypeTemplateParm{{.*}}'I' 'unsigned int'
227 // CHECK-NEXT: WhileStmt
228 // CHECK-NEXT: CXXBoolLiteralExpr
229 // CHECK-NEXT: NullStmt
230 #pragma acc parallel firstprivate(I)
231 while(true);
232 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
233 // CHECK-NEXT: firstprivate clause
234 // CHECK-NEXT: DeclRefExpr{{.*}}'unsigned int' NonTypeTemplateParm{{.*}}'I' 'unsigned int'
235 // CHECK-NEXT: WhileStmt
236 // CHECK-NEXT: CXXBoolLiteralExpr
237 // CHECK-NEXT: NullStmt
240 template<auto &NTTP, typename T, typename U>
241 void TemplUses(T t, U u, T*PointerParam) {
242 // CHECK-NEXT: FunctionTemplateDecl
243 // CHECK-NEXT: NonTypeTemplateParmDecl {{.*}}referenced 'auto &' depth 0 index 0 NTTP
244 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 1 T
245 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 2 U
246 // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (T, U, T *)'
247 // CHECK-NEXT: ParmVarDecl{{.*}} referenced t 'T'
248 // CHECK-NEXT: ParmVarDecl{{.*}} referenced u 'U'
249 // CHECK-NEXT: ParmVarDecl{{.*}} referenced PointerParam 'T *'
250 // CHECK-NEXT: CompoundStmt
253 #pragma acc parallel private(GlobalArray, PointerParam[Global])
254 while(true);
255 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
256 // CHECK-NEXT: private clause
257 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
258 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'T' lvalue
259 // CHECK-NEXT: DeclRefExpr{{.*}}'T *' lvalue ParmVar{{.*}}'PointerParam' 'T *'
260 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
261 // CHECK-NEXT: WhileStmt
262 // CHECK-NEXT: CXXBoolLiteralExpr
263 // CHECK-NEXT: NullStmt
265 #pragma acc parallel private(t, u)
266 while(true);
267 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
268 // CHECK-NEXT: private clause
269 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
270 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
271 // CHECK-NEXT: WhileStmt
272 // CHECK-NEXT: CXXBoolLiteralExpr
273 // CHECK-NEXT: NullStmt
275 #pragma acc parallel firstprivate(t, u)
276 while(true);
277 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
278 // CHECK-NEXT: firstprivate clause
279 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
280 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
281 // CHECK-NEXT: WhileStmt
282 // CHECK-NEXT: CXXBoolLiteralExpr
283 // CHECK-NEXT: NullStmt
285 #pragma acc parallel private(t) private(u)
286 while(true);
287 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
288 // CHECK-NEXT: private clause
289 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
290 // CHECK-NEXT: private clause
291 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
292 // CHECK-NEXT: WhileStmt
293 // CHECK-NEXT: CXXBoolLiteralExpr
294 // CHECK-NEXT: NullStmt
296 #pragma acc parallel private(t) private(NTTP, u)
297 while(true);
298 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
299 // CHECK-NEXT: private clause
300 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
301 // CHECK-NEXT: private clause
302 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
303 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
304 // CHECK-NEXT: WhileStmt
305 // CHECK-NEXT: CXXBoolLiteralExpr
306 // CHECK-NEXT: NullStmt
308 #pragma acc parallel private(t) firstprivate(NTTP, u)
309 while(true);
310 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
311 // CHECK-NEXT: private clause
312 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
313 // CHECK-NEXT: firstprivate clause
314 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
315 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
316 // CHECK-NEXT: WhileStmt
317 // CHECK-NEXT: CXXBoolLiteralExpr
318 // CHECK-NEXT: NullStmt
320 #pragma acc parallel no_create(t) present(NTTP, u)
321 while(true);
322 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
323 // CHECK-NEXT: no_create clause
324 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
325 // CHECK-NEXT: present clause
326 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
327 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
328 // CHECK-NEXT: WhileStmt
329 // CHECK-NEXT: CXXBoolLiteralExpr
330 // CHECK-NEXT: NullStmt
332 #pragma acc parallel copy(t) pcopy(NTTP, u) present_or_copy(u[0:t])
333 while(true);
334 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
335 // CHECK-NEXT: copy clause
336 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
337 // CHECK-NEXT: pcopy clause
338 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
339 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
340 // CHECK-NEXT: present_or_copy clause
341 // CHECK-NEXT: ArraySectionExpr
342 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
343 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
344 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
345 // CHECK-NEXT: WhileStmt
346 // CHECK-NEXT: CXXBoolLiteralExpr
347 // CHECK-NEXT: NullStmt
349 #pragma acc parallel copyin(t) pcopyin(readonly:NTTP, u) present_or_copyin(u[0:t])
350 while(true);
351 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
352 // CHECK-NEXT: copyin clause
353 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
354 // CHECK-NEXT: pcopyin clause : readonly
355 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
356 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
357 // CHECK-NEXT: present_or_copyin clause
358 // CHECK-NEXT: ArraySectionExpr
359 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
360 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
361 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
362 // CHECK-NEXT: WhileStmt
363 // CHECK-NEXT: CXXBoolLiteralExpr
364 // CHECK-NEXT: NullStmt
366 #pragma acc parallel copyout(t) pcopyout(zero:NTTP, u) present_or_copyout(u[0:t])
367 while(true);
368 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
369 // CHECK-NEXT: copyout clause
370 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
371 // CHECK-NEXT: pcopyout clause : zero
372 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
373 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
374 // CHECK-NEXT: present_or_copyout clause
375 // CHECK-NEXT: ArraySectionExpr
376 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
377 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
378 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
379 // CHECK-NEXT: WhileStmt
380 // CHECK-NEXT: CXXBoolLiteralExpr
381 // CHECK-NEXT: NullStmt
383 #pragma acc parallel create(t) pcreate(zero: NTTP, u) present_or_create(u[0:t])
384 while(true);
385 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
386 // CHECK-NEXT: create clause
387 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
388 // CHECK-NEXT: pcreate clause : zero
389 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
390 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
391 // CHECK-NEXT: present_or_create clause
392 // CHECK-NEXT: ArraySectionExpr
393 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
394 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
395 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
396 // CHECK-NEXT: WhileStmt
397 // CHECK-NEXT: CXXBoolLiteralExpr
398 // CHECK-NEXT: NullStmt
400 #pragma acc parallel private(u[0])
401 while(true);
402 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
403 // CHECK-NEXT: private clause
404 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'<dependent type>' lvalue
405 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
406 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
407 // CHECK-NEXT: WhileStmt
408 // CHECK-NEXT: CXXBoolLiteralExpr
409 // CHECK-NEXT: NullStmt
411 #pragma acc parallel private(u[0:t])
412 while(true);
413 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
414 // CHECK-NEXT: private clause
415 // CHECK-NEXT: ArraySectionExpr
416 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
417 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
418 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
419 // CHECK-NEXT: WhileStmt
420 // CHECK-NEXT: CXXBoolLiteralExpr
421 // CHECK-NEXT: NullStmt
423 #pragma acc parallel attach(PointerParam) deviceptr(PointerParam)
424 while (true);
425 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
426 // CHECK-NEXT: attach clause
427 // CHECK-NEXT: DeclRefExpr{{.*}}'T *' lvalue ParmVar{{.*}} 'PointerParam' 'T *'
428 // CHECK-NEXT: deviceptr clause
429 // CHECK-NEXT: DeclRefExpr{{.*}}'T *' lvalue ParmVar{{.*}} 'PointerParam' 'T *'
430 // CHECK-NEXT: WhileStmt
431 // CHECK-NEXT: CXXBoolLiteralExpr
432 // CHECK-NEXT: NullStmt
434 // CHECK-NEXT: DeclStmt
435 // CHECK-NEXT: VarDecl{{.*}}EndMarker
436 int EndMarker;
438 // Check the instantiated versions of the above.
439 // CHECK-NEXT: FunctionDecl{{.*}} used TemplUses 'void (int, int *, int *)' implicit_instantiation
440 // CHECK-NEXT: TemplateArgument decl
441 // CHECK-NEXT: Var{{.*}} 'CEVar' 'const unsigned int'
442 // CHECK-NEXT: TemplateArgument type 'int'
443 // CHECK-NEXT: BuiltinType{{.*}} 'int'
444 // CHECK-NEXT: TemplateArgument type 'int[1]'
445 // CHECK-NEXT: ConstantArrayType{{.*}} 'int[1]'{{.*}} 1
446 // CHECK-NEXT: BuiltinType{{.*}} 'int'
447 // CHECK-NEXT: ParmVarDecl{{.*}} used t 'int'
448 // CHECK-NEXT: ParmVarDecl{{.*}} used u 'int *'
449 // CHECK-NEXT: ParmVarDecl{{.*}} used PointerParam 'int *'
450 // CHECK-NEXT: CompoundStmt
452 // #pragma acc parallel private(GlobalArray, PointerParam[Global])
453 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
454 // CHECK-NEXT: private clause
455 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
456 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'int' lvalue
457 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
458 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}}'PointerParam' 'int *'
459 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
460 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
461 // CHECK-NEXT: WhileStmt
462 // CHECK-NEXT: CXXBoolLiteralExpr
463 // CHECK-NEXT: NullStmt
465 // #pragma acc parallel private(t, u)
466 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
467 // CHECK-NEXT: private clause
468 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
469 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
470 // CHECK-NEXT: WhileStmt
471 // CHECK-NEXT: CXXBoolLiteralExpr
472 // CHECK-NEXT: NullStmt
474 // #pragma acc parallel firstprivate(t, u)
475 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
476 // CHECK-NEXT: firstprivate clause
477 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
478 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
479 // CHECK-NEXT: WhileStmt
480 // CHECK-NEXT: CXXBoolLiteralExpr
481 // CHECK-NEXT: NullStmt
483 // #pragma acc parallel private(t) private(u)
484 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
485 // CHECK-NEXT: private clause
486 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
487 // CHECK-NEXT: private clause
488 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
489 // CHECK-NEXT: WhileStmt
490 // CHECK-NEXT: CXXBoolLiteralExpr
491 // CHECK-NEXT: NullStmt
493 // #pragma acc parallel private(t) private(NTTP, u)
494 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
495 // CHECK-NEXT: private clause
496 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
497 // CHECK-NEXT: private clause
498 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
499 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
500 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
501 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
502 // CHECK-NEXT: WhileStmt
503 // CHECK-NEXT: CXXBoolLiteralExpr
504 // CHECK-NEXT: NullStmt
506 // #pragma acc parallel private(t) firstprivate(NTTP, u)
507 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
508 // CHECK-NEXT: private clause
509 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
510 // CHECK-NEXT: firstprivate clause
511 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
512 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
513 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
514 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
515 // CHECK-NEXT: WhileStmt
516 // CHECK-NEXT: CXXBoolLiteralExpr
517 // CHECK-NEXT: NullStmt
519 // #pragma acc parallel no_create(t) present(NTTP, u)
520 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
521 // CHECK-NEXT: no_create clause
522 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
523 // CHECK-NEXT: present clause
524 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
525 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
526 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
527 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
528 // CHECK-NEXT: WhileStmt
529 // CHECK-NEXT: CXXBoolLiteralExpr
530 // CHECK-NEXT: NullStmt
532 //#pragma acc parallel copy(t) pcopy(NTTP, u) copy_or_present(u[0:t])
533 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
534 // CHECK-NEXT: copy clause
535 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
536 // CHECK-NEXT: pcopy clause
537 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
538 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
539 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
540 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
541 // CHECK-NEXT: present_or_copy clause
542 // CHECK-NEXT: ArraySectionExpr
543 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
544 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
545 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
546 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
547 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
548 // CHECK-NEXT: WhileStmt
549 // CHECK-NEXT: CXXBoolLiteralExpr
550 // CHECK-NEXT: NullStmt
552 //#pragma acc parallel copyin(t) pcopyin(readonly:NTTP, u) present_or_copyin(u[0:t])
553 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
554 // CHECK-NEXT: copyin clause
555 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
556 // CHECK-NEXT: pcopyin clause : readonly
557 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
558 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
559 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
560 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
561 // CHECK-NEXT: present_or_copyin clause
562 // CHECK-NEXT: ArraySectionExpr
563 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
564 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
565 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
566 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
567 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
568 // CHECK-NEXT: WhileStmt
569 // CHECK-NEXT: CXXBoolLiteralExpr
570 // CHECK-NEXT: NullStmt
572 //#pragma acc parallel copyout(t) pcopyout(zero:NTTP, u) present_or_copyout(u[0:t])
573 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
574 // CHECK-NEXT: copyout clause
575 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
576 // CHECK-NEXT: pcopyout clause : zero
577 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
578 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
579 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
580 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
581 // CHECK-NEXT: present_or_copyout clause
582 // CHECK-NEXT: ArraySectionExpr
583 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
584 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
585 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
586 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
587 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
588 // CHECK-NEXT: WhileStmt
589 // CHECK-NEXT: CXXBoolLiteralExpr
590 // CHECK-NEXT: NullStmt
592 //#pragma acc parallel create(t) pcreate(zero: NTTP, u) present_or_create(u[0:t])
593 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
594 // CHECK-NEXT: create clause
595 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
596 // CHECK-NEXT: pcreate clause : zero
597 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
598 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
599 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
600 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
601 // CHECK-NEXT: present_or_create clause
602 // CHECK-NEXT: ArraySectionExpr
603 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
604 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
605 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
606 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
607 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
608 // CHECK-NEXT: WhileStmt
609 // CHECK-NEXT: CXXBoolLiteralExpr
610 // CHECK-NEXT: NullStmt
612 // #pragma acc parallel private(u[0])
613 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
614 // CHECK-NEXT: private clause
615 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'int' lvalue
616 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
617 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
618 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
619 // CHECK-NEXT: WhileStmt
620 // CHECK-NEXT: CXXBoolLiteralExpr
621 // CHECK-NEXT: NullStmt
623 // #pragma acc parallel private(u[0:t])
624 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
625 // CHECK-NEXT: private clause
626 // CHECK-NEXT: ArraySectionExpr
627 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
628 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
629 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
630 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
631 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
632 // CHECK-NEXT: WhileStmt
633 // CHECK-NEXT: CXXBoolLiteralExpr
634 // CHECK-NEXT: NullStmt
636 //#pragma acc parallel attach(PointerParam) deviceptr(PointerParam)
637 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
638 // CHECK-NEXT: attach clause
639 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'PointerParam' 'int *'
640 // CHECK-NEXT: deviceptr clause
641 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'PointerParam' 'int *'
642 // CHECK-NEXT: WhileStmt
643 // CHECK-NEXT: CXXBoolLiteralExpr
644 // CHECK-NEXT: NullStmt
646 // CHECK-NEXT: DeclStmt
647 // CHECK-NEXT: VarDecl{{.*}}EndMarker
650 struct S {
651 // CHECK-NEXT: CXXRecordDecl{{.*}} struct S definition
652 // CHECK: CXXRecordDecl{{.*}} implicit struct S
653 int ThisMember;
654 // CHECK-NEXT: FieldDecl{{.*}} ThisMember 'int'
655 int *ThisMemberPtr;
656 // CHECK-NEXT: FieldDecl{{.*}} ThisMemberPtr 'int *'
657 int ThisMemberArray[5];
658 // CHECK-NEXT: FieldDecl{{.*}} ThisMemberArray 'int[5]'
660 void foo();
661 // CHECK-NEXT: CXXMethodDecl{{.*}} foo 'void ()'
663 template<typename T>
664 void bar(T *PointerParam) {
665 // CHECK-NEXT: FunctionTemplateDecl{{.*}}bar
666 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 0 T
667 // CHECK-NEXT: CXXMethodDecl{{.*}} bar 'void (T *)' implicit-inline
668 // CHECK-NEXT: ParmVarDecl{{.*}} PointerParam 'T *'
669 // CHECK-NEXT: CompoundStmt
671 #pragma acc parallel private(ThisMember, this->ThisMemberArray[1])
672 while(true);
673 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
674 // CHECK-NEXT: private clause
675 // CHECK-NEXT: MemberExpr{{.*}} 'int' lvalue ->ThisMember
676 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
677 // CHECK-NEXT: ArraySubscriptExpr{{.*}} 'int' lvalue
678 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
679 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
680 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
681 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
682 // CHECK-NEXT: WhileStmt
683 // CHECK-NEXT: CXXBoolLiteralExpr
684 // CHECK-NEXT: NullStmt
686 #pragma acc parallel private(ThisMemberArray[1:2])
687 while(true);
688 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
689 // CHECK-NEXT: private clause
690 // CHECK-NEXT: ArraySectionExpr{{.*}}
691 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
692 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
693 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
694 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
695 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 2
696 // CHECK-NEXT: WhileStmt
697 // CHECK-NEXT: CXXBoolLiteralExpr
698 // CHECK-NEXT: NullStmt
700 #pragma acc parallel private(this)
701 while(true);
702 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
703 // CHECK-NEXT: private clause
704 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
705 // CHECK-NEXT: WhileStmt
706 // CHECK-NEXT: CXXBoolLiteralExpr
707 // CHECK-NEXT: NullStmt
709 #pragma acc parallel attach(PointerParam, this, this->ThisMemberPtr) deviceptr(PointerParam, this, ThisMemberPtr)
710 while (true);
711 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
712 // CHECK-NEXT: attach clause
713 // CHECK-NEXT: DeclRefExpr{{.*}} 'T *' lvalue ParmVar{{.*}} 'PointerParam' 'T *'
714 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
715 // CHECK-NEXT: MemberExpr{{.*}} 'int *' lvalue ->ThisMemberPtr
716 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
717 // CHECK-NEXT: deviceptr clause
718 // CHECK-NEXT: DeclRefExpr{{.*}} 'T *' lvalue ParmVar{{.*}} 'PointerParam' 'T *'
719 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
720 // CHECK-NEXT: MemberExpr{{.*}} 'int *' lvalue ->ThisMemberPtr
721 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
722 // CHECK-NEXT: WhileStmt
723 // CHECK-NEXT: CXXBoolLiteralExpr
724 // CHECK-NEXT: NullStmt
726 // Check Instantiations:
727 // CHECK-NEXT: CXXMethodDecl{{.*}} used bar 'void (int *)' implicit_instantiation implicit-inline
728 // CHECK-NEXT: TemplateArgument type 'int'
729 // CHECK-NEXT: BuiltinType{{.*}} 'int'
730 // CHECK-NEXT: ParmVarDecl{{.*}} PointerParam 'int *'
731 // CHECK-NEXT: CompoundStmt
733 // #pragma acc parallel private(ThisMember, this->ThisMemberArray[1])
734 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
735 // CHECK-NEXT: private clause
736 // CHECK-NEXT: MemberExpr{{.*}} 'int' lvalue ->ThisMember
737 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
738 // CHECK-NEXT: ArraySubscriptExpr{{.*}} 'int' lvalue
739 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
740 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
741 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
742 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
743 // CHECK-NEXT: WhileStmt
744 // CHECK-NEXT: CXXBoolLiteralExpr
745 // CHECK-NEXT: NullStmt
747 // #pragma acc parallel private(ThisMemberArray[1:2])
748 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
749 // CHECK-NEXT: private clause
750 // CHECK-NEXT: ArraySectionExpr{{.*}}
751 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
752 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
753 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
754 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
755 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 2
756 // CHECK-NEXT: WhileStmt
757 // CHECK-NEXT: CXXBoolLiteralExpr
758 // CHECK-NEXT: NullStmt
760 // #pragma acc parallel private(this)
761 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
762 // CHECK-NEXT: private clause
763 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
764 // CHECK-NEXT: WhileStmt
765 // CHECK-NEXT: CXXBoolLiteralExpr
766 // CHECK-NEXT: NullStmt
768 //#pragma acc parallel attach(PointerParam, this, this->ThisMemberPtr) deviceptr(PointerParam, this, ThisMemberPtr)
769 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
770 // CHECK-NEXT: attach clause
771 // CHECK-NEXT: DeclRefExpr{{.*}} 'int *' lvalue ParmVar{{.*}} 'PointerParam' 'int *'
772 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
773 // CHECK-NEXT: MemberExpr{{.*}} 'int *' lvalue ->ThisMemberPtr
774 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
775 // CHECK-NEXT: deviceptr clause
776 // CHECK-NEXT: DeclRefExpr{{.*}} 'int *' lvalue ParmVar{{.*}} 'PointerParam' 'int *'
777 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
778 // CHECK-NEXT: MemberExpr{{.*}} 'int *' lvalue ->ThisMemberPtr
779 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
780 // CHECK-NEXT: WhileStmt
781 // CHECK-NEXT: CXXBoolLiteralExpr
782 // CHECK-NEXT: NullStmt
786 void S::foo() {
787 // CHECK: CXXMethodDecl{{.*}} foo 'void ()'
788 // CHECK-NEXT: CompoundStmt
789 #pragma acc parallel private(ThisMember, this->ThisMemberArray[1])
790 while(true);
791 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
792 // CHECK-NEXT: private clause
793 // CHECK-NEXT: MemberExpr{{.*}} 'int' lvalue ->ThisMember
794 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
795 // CHECK-NEXT: ArraySubscriptExpr{{.*}} 'int' lvalue
796 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
797 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
798 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
799 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
800 // CHECK-NEXT: WhileStmt
801 // CHECK-NEXT: CXXBoolLiteralExpr
802 // CHECK-NEXT: NullStmt
804 #pragma acc parallel private(ThisMemberArray[1:2])
805 while(true);
806 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
807 // CHECK-NEXT: private clause
808 // CHECK-NEXT: ArraySectionExpr{{.*}}
809 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
810 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
811 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' implicit this
812 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
813 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 2
814 // CHECK-NEXT: WhileStmt
815 // CHECK-NEXT: CXXBoolLiteralExpr
816 // CHECK-NEXT: NullStmt
818 #pragma acc parallel private(this)
819 while(true);
820 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
821 // CHECK-NEXT: private clause
822 // CHECK-NEXT: CXXThisExpr{{.*}} 'S *' this
823 // CHECK-NEXT: WhileStmt
824 // CHECK-NEXT: CXXBoolLiteralExpr
825 // CHECK-NEXT: NullStmt
828 template<typename U>
829 struct STempl {
830 // CHECK-NEXT: ClassTemplateDecl{{.*}} STempl
831 // CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename depth 0 index 0 U
832 // CHECK-NEXT: CXXRecordDecl{{.*}} struct STempl definition
833 // CHECK: CXXRecordDecl{{.*}} implicit struct STempl
834 U ThisMember;
835 // CHECK-NEXT: FieldDecl{{.*}} ThisMember 'U'
836 U ThisMemberArray[5];
837 // CHECK-NEXT: FieldDecl{{.*}} ThisMemberArray 'U[5]'
839 void foo() {
840 // CHECK-NEXT: CXXMethodDecl {{.*}} foo 'void ()'
841 // CHECK-NEXT: CompoundStmt
843 #pragma acc parallel private(ThisMember, this->ThisMemberArray[1])
844 while(true);
845 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
846 // CHECK-NEXT: private clause
847 // CHECK-NEXT: MemberExpr{{.*}} 'U' lvalue ->ThisMember
848 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' implicit this
849 // CHECK-NEXT: ArraySubscriptExpr{{.*}} 'U' lvalue
850 // CHECK-NEXT: MemberExpr{{.*}} 'U[5]' lvalue ->ThisMemberArray
851 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' this
852 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
853 // CHECK-NEXT: WhileStmt
854 // CHECK-NEXT: CXXBoolLiteralExpr
855 // CHECK-NEXT: NullStmt
857 #pragma acc parallel private(ThisMemberArray[1:2])
858 while(true);
859 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
860 // CHECK-NEXT: private clause
861 // CHECK-NEXT: ArraySectionExpr{{.*}}
862 // CHECK-NEXT: MemberExpr{{.*}} 'U[5]' lvalue ->ThisMemberArray
863 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' implicit this
864 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
865 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 2
866 // CHECK-NEXT: WhileStmt
867 // CHECK-NEXT: CXXBoolLiteralExpr
868 // CHECK-NEXT: NullStmt
870 #pragma acc parallel private(this)
871 while(true);
872 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
873 // CHECK-NEXT: private clause
874 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' this
875 // CHECK-NEXT: WhileStmt
876 // CHECK-NEXT: CXXBoolLiteralExpr
877 // CHECK-NEXT: NullStmt
880 template<typename T>
881 void bar() {
882 // CHECK-NEXT: FunctionTemplateDecl{{.*}} bar
883 // CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename depth 1 index 0 T
884 // CHECK-NEXT: CXXMethodDecl{{.*}} bar 'void ()'
885 // CHECK-NEXT: CompoundStmt
887 #pragma acc parallel private(ThisMember, this->ThisMemberArray[1])
888 while(true);
889 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
890 // CHECK-NEXT: private clause
891 // CHECK-NEXT: MemberExpr{{.*}} 'U' lvalue ->ThisMember
892 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' implicit this
893 // CHECK-NEXT: ArraySubscriptExpr{{.*}} 'U' lvalue
894 // CHECK-NEXT: MemberExpr{{.*}} 'U[5]' lvalue ->ThisMemberArray
895 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' this
896 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
897 // CHECK-NEXT: WhileStmt
898 // CHECK-NEXT: CXXBoolLiteralExpr
899 // CHECK-NEXT: NullStmt
901 #pragma acc parallel private(ThisMemberArray[1:2])
902 while(true);
903 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
904 // CHECK-NEXT: private clause
905 // CHECK-NEXT: ArraySectionExpr{{.*}}
906 // CHECK-NEXT: MemberExpr{{.*}} 'U[5]' lvalue ->ThisMemberArray
907 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' implicit this
908 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
909 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 2
910 // CHECK-NEXT: WhileStmt
911 // CHECK-NEXT: CXXBoolLiteralExpr
912 // CHECK-NEXT: NullStmt
914 #pragma acc parallel private(this)
915 while(true);
916 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
917 // CHECK-NEXT: private clause
918 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<U> *' this
919 // CHECK-NEXT: WhileStmt
920 // CHECK-NEXT: CXXBoolLiteralExpr
921 // CHECK-NEXT: NullStmt
924 // Instantiation of the class template.
926 // CHECK-NEXT: ClassTemplateSpecializationDecl{{.*}}struct STempl
927 // CHECK: TemplateArgument type 'int'
928 // CHECK-NEXT: BuiltinType {{.*}}'int'
929 // CHECK-NEXT: CXXRecordDecl{{.*}} struct STempl
930 // CHECK-NEXT: FieldDecl{{.*}}ThisMember 'int'
931 // CHECK-NEXT: FieldDecl{{.*}} ThisMemberArray 'int[5]'
933 // CHECK-NEXT: CXXMethodDecl{{.*}} foo 'void ()'
934 // CHECK-NEXT: FunctionTemplateDecl{{.*}}bar
935 // CHECK-NEXT: TemplateTypeParmDecl{{.*}} typename depth 0 index 0 T
936 // CHECK-NEXT: CXXMethodDecl{{.*}}bar 'void ()'
937 // CHECK-NEXT: CXXMethodDecl{{.*}}bar 'void ()'
938 // CHECK-NEXT: TemplateArgument type 'int'
939 // CHECK-NEXT: BuiltinType{{.*}} 'int'
940 // CHECK-NEXT: CompoundStmt
942 //#pragma acc parallel private(ThisMember, this->ThisMemberArray[1])
943 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
944 // CHECK-NEXT: private clause
945 // CHECK-NEXT: MemberExpr{{.*}} 'int' lvalue ->ThisMember
946 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<int> *' implicit this
947 // CHECK-NEXT: ArraySubscriptExpr{{.*}} 'int' lvalue
948 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
949 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
950 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<int> *' this
951 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
952 // CHECK-NEXT: WhileStmt
953 // CHECK-NEXT: CXXBoolLiteralExpr
954 // CHECK-NEXT: NullStmt
956 //#pragma acc parallel private(ThisMemberArray[1:2])
957 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
958 // CHECK-NEXT: private clause
959 // CHECK-NEXT: ArraySectionExpr{{.*}}
960 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <ArrayToPointerDecay>
961 // CHECK-NEXT: MemberExpr{{.*}} 'int[5]' lvalue ->ThisMemberArray
962 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<int> *' implicit this
963 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 1
964 // CHECK-NEXT: IntegerLiteral{{.*}}'int' 2
965 // CHECK-NEXT: WhileStmt
966 // CHECK-NEXT: CXXBoolLiteralExpr
967 // CHECK-NEXT: NullStmt
969 //#pragma acc parallel private(this)
970 // CHECK-NEXT: OpenACCComputeConstruct{{.*}} parallel
971 // CHECK-NEXT: private clause
972 // CHECK-NEXT: CXXThisExpr{{.*}} 'STempl<int> *' this
973 // CHECK-NEXT: WhileStmt
974 // CHECK-NEXT: CXXBoolLiteralExpr
975 // CHECK-NEXT: NullStmt
978 void Inst() {
979 static constexpr unsigned CEVar = 1;
980 int i;
981 int Arr[5];
982 TemplUses<CEVar, int, int[1]>({}, {}, &i);
984 S s;
985 s.bar<int>(&i);
986 STempl<int> stempl;
987 stempl.bar<int>();
989 #endif