1 // RUN: %clang_cc1 %s -fopenacc -Wno-openacc-deprecated-clause-alias -ast-dump | FileCheck %s
4 // RUN: %clang_cc1 %s -fopenacc -Wno-openacc-deprecated-clause-alias -emit-pch -o %t %s
5 // RUN: %clang_cc1 %s -fopenacc -Wno-openacc-deprecated-clause-alias -include-pch %t -ast-dump-all | FileCheck %s
12 void NormalUses(float *PointerParam
) {
13 // CHECK: FunctionDecl{{.*}}NormalUses
15 // CHECK-NEXT: CompoundStmt
17 #pragma acc data copyin(GlobalArray) pcopyin(readonly:PointerParam[Global]) present_or_copyin(Global)
19 // CHECK-NEXT: OpenACCDataConstruct{{.*}} data
20 // CHECK-NEXT: copyin clause
21 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
22 // CHECK-NEXT: pcopyin clause : readonly
23 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
24 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
25 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
26 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
27 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
28 // CHECK-NEXT: present_or_copyin clause
29 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
30 // CHECK-NEXT: NullStmt
32 #pragma acc enter data copyin(GlobalArray) pcopyin(readonly:PointerParam[Global]) present_or_copyin(Global)
33 // CHECK-NEXT: OpenACCEnterDataConstruct{{.*}} enter data
34 // CHECK-NEXT: copyin clause
35 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
36 // CHECK-NEXT: pcopyin clause : readonly
37 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
38 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
39 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
40 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
41 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
42 // CHECK-NEXT: present_or_copyin clause
43 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
46 template<auto &NTTP
, typename T
, typename U
>
47 void TemplUses(T t
, U u
) {
48 // CHECK-NEXT: FunctionTemplateDecl
49 // CHECK-NEXT: NonTypeTemplateParmDecl {{.*}}referenced 'auto &' depth 0 index 0 NTTP
50 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 1 T
51 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 2 U
52 // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (T, U)'
53 // CHECK-NEXT: ParmVarDecl{{.*}} referenced t 'T'
54 // CHECK-NEXT: ParmVarDecl{{.*}} referenced u 'U'
55 // CHECK-NEXT: CompoundStmt
57 #pragma acc data copyin(t) pcopyin(readonly: NTTP, u) present_or_copyin(u[0:t])
59 // CHECK-NEXT: OpenACCDataConstruct{{.*}} data
60 // CHECK-NEXT: copyin clause
61 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
62 // CHECK-NEXT: pcopyin clause : readonly
63 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
64 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
65 // CHECK-NEXT: present_or_copyin clause
66 // CHECK-NEXT: ArraySectionExpr
67 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
68 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
69 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
70 // CHECK-NEXT: NullStmt
72 #pragma acc enter data copyin(t) pcopyin(readonly: NTTP, u) present_or_copyin(u[0:t])
73 // CHECK-NEXT: OpenACCEnterDataConstruct{{.*}} enter data
74 // CHECK-NEXT: copyin clause
75 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
76 // CHECK-NEXT: pcopyin clause : readonly
77 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
78 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
79 // CHECK-NEXT: present_or_copyin clause
80 // CHECK-NEXT: ArraySectionExpr
81 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
82 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
83 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
85 // Check the instantiated versions of the above.
86 // CHECK-NEXT: FunctionDecl{{.*}} used TemplUses 'void (int, int *)' implicit_instantiation
87 // CHECK-NEXT: TemplateArgument decl
88 // CHECK-NEXT: Var{{.*}} 'CEVar' 'const unsigned int'
89 // CHECK-NEXT: TemplateArgument type 'int'
90 // CHECK-NEXT: BuiltinType{{.*}} 'int'
91 // CHECK-NEXT: TemplateArgument type 'int *'
92 // CHECK-NEXT: PointerType{{.*}} 'int *'
93 // CHECK-NEXT: BuiltinType{{.*}} 'int'
94 // CHECK-NEXT: ParmVarDecl{{.*}} used t 'int'
95 // CHECK-NEXT: ParmVarDecl{{.*}} used u 'int *'
96 // CHECK-NEXT: CompoundStmt
98 // CHECK-NEXT: OpenACCDataConstruct{{.*}} data
99 // CHECK-NEXT: copyin clause
100 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
101 // CHECK-NEXT: pcopyin clause : readonly
102 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
103 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
104 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
105 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
106 // CHECK-NEXT: present_or_copyin clause
107 // CHECK-NEXT: ArraySectionExpr
108 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
109 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
110 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
111 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
112 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
113 // CHECK-NEXT: NullStmt
115 // CHECK-NEXT: OpenACCEnterDataConstruct{{.*}} enter data
116 // CHECK-NEXT: copyin clause
117 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
118 // CHECK-NEXT: pcopyin clause : readonly
119 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
120 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
121 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
122 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
123 // CHECK-NEXT: present_or_copyin clause
124 // CHECK-NEXT: ArraySectionExpr
125 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
126 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
127 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
128 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
129 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
133 static constexpr unsigned CEVar
= 1;
135 TemplUses
<CEVar
>(i
, &i
);