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