• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
4 // expected-no-diagnostics
5 
6 #ifndef HEADER
7 #define HEADER
8 
9 template <typename T, int C>
tmain(T argc,T * argv)10 T tmain(T argc, T *argv) {
11   T i, j, b, c, d, e, x[20];
12 
13   i = argc;
14 #pragma omp target exit data map(from: i)
15 
16 #pragma omp target exit data map(from: i) if (target exit data: j > 0)
17 
18 #pragma omp target exit data map(from: i) if (b)
19 
20 #pragma omp target exit data map(from: c)
21 
22 #pragma omp target exit data map(from: c) if(b>e)
23 
24 #pragma omp target exit data map(release: x[0:10], c)
25 
26 #pragma omp target exit data map(delete: x[0:10])
27 
28 #pragma omp target exit data map(always, delete: x[0:10])
29 
30 #pragma omp target exit data map(from: c) map(release: d)
31 
32 #pragma omp target exit data map(always,release: e)
33 
34 #pragma omp target exit data nowait map(from: i)
35 
36 #pragma omp target exit data nowait map(from: i) if (target exit data: j > 0)
37 
38 #pragma omp target exit data map(from: i) if (b) nowait
39 
40 #pragma omp target exit data map(from: c) nowait
41 
42 #pragma omp target exit data map(from: c) nowait if(b>e)
43 
44 #pragma omp target exit data nowait map(release: x[0:10], c)
45 
46 #pragma omp target exit data nowait map(from: c) map(release: d)
47 
48 #pragma omp target exit data nowait map(always,release: e)
49 
50 #pragma omp target exit data depend(in : argc, argv[i:argc], x[:]) nowait map(from: i)
51 
52 #pragma omp target exit data nowait depend(in : argc, argv[i:argc], x[:]) map(from: i) if (target exit data: j > 0)
53 
54 #pragma omp target exit data map(from: i) depend(in : argc, argv[i:argc], x[:]) if (b) nowait
55 
56 #pragma omp target exit data map(from: c) depend(in : argc, argv[i:argc], x[:]) nowait
57 
58 #pragma omp target exit data map(from: c) depend(in : argc, argv[i:argc], x[:]) nowait if(b>e)
59 
60 #pragma omp target exit data nowait map(release: x[0:10], c) depend(in : argc, argv[i:argc], x[:])
61 
62 #pragma omp target exit data nowait map(from: c) depend(in : argc, argv[i:argc], x[:]) map(release: d)
63 
64 #pragma omp target exit data depend(in : argc, argv[i:argc], x[:]) nowait map(always,release: e)
65 
66   return 0;
67 }
68 
69 // CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
70 // CHECK-NEXT: int i, j, b, c, d, e, x[20];
71 // CHECK-NEXT: i = argc;
72 // CHECK-NEXT: #pragma omp target exit data map(from: i)
73 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0)
74 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
75 // CHECK-NEXT: #pragma omp target exit data map(from: c)
76 // CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
77 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
78 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
79 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
80 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
81 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
82 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
83 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
84 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
85 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
86 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
87 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
88 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
89 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
90 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
91 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
92 // CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
93 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
94 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
95 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
96 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
97 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e)
98 // CHECK: template <typename T = char, int C = 1> char tmain(char argc, char *argv) {
99 // CHECK-NEXT: char i, j, b, c, d, e, x[20];
100 // CHECK-NEXT: i = argc;
101 // CHECK-NEXT: #pragma omp target exit data map(from: i)
102 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0)
103 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
104 // CHECK-NEXT: #pragma omp target exit data map(from: c)
105 // CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
106 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
107 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
108 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
109 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
110 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
111 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
112 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
113 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
114 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
115 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
116 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
117 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
118 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
119 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
120 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
121 // CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
122 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
123 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
124 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
125 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
126 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e)
127 // CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
128 // CHECK-NEXT: T i, j, b, c, d, e, x[20];
129 // CHECK-NEXT: i = argc;
130 // CHECK-NEXT: #pragma omp target exit data map(from: i)
131 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0)
132 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
133 // CHECK-NEXT: #pragma omp target exit data map(from: c)
134 // CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
135 // CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
136 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
137 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
138 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
139 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
140 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
141 // CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
142 // CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
143 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
144 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
145 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
146 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
147 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
148 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
149 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
150 // CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
151 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
152 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
153 // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
154 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
155 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e)
156 
main(int argc,char ** argv)157 int main (int argc, char **argv) {
158   int b = argc, i, c, d, e, f, g, x[20];
159   static int a;
160 // CHECK: static int a;
161 
162 #pragma omp target exit data map(from: a)
163 // CHECK:      #pragma omp target exit data map(from: a)
164   a=2;
165 // CHECK-NEXT: a = 2;
166 #pragma omp target exit data map(from: a) if (target exit data: b)
167 // CHECK: #pragma omp target exit data map(from: a) if(target exit data: b)
168 
169 #pragma omp target exit data map(from: a) if (b > g)
170 // CHECK: #pragma omp target exit data map(from: a) if(b > g)
171 
172 #pragma omp target exit data map(from: c)
173 // CHECK-NEXT: #pragma omp target exit data map(from: c)
174 
175 #pragma omp target exit data map(release: c) if(b>g)
176 // CHECK-NEXT: #pragma omp target exit data map(release: c) if(b > g)
177 
178 #pragma omp target exit data map(from: x[0:10], c)
179 // CHECK-NEXT: #pragma omp target exit data map(from: x[0:10],c)
180 
181 #pragma omp target exit data map(delete: x[0:10])
182 // CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
183 
184 #pragma omp target exit data map(always, delete: x[0:10])
185 // CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
186 
187 #pragma omp target exit data map(from: c) map(release: d)
188 // CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
189 
190 #pragma omp target exit data map(always,release: e)
191 // CHECK-NEXT: #pragma omp target exit data map(always,release: e)
192 
193 #pragma omp target exit data nowait map(from: a)
194 // CHECK:      #pragma omp target exit data nowait map(from: a)
195 
196 #pragma omp target exit data nowait map(from: a) if (target exit data: b)
197 // CHECK: #pragma omp target exit data nowait map(from: a) if(target exit data: b)
198 
199 #pragma omp target exit data map(from: a) if (b > g) nowait
200 // CHECK: #pragma omp target exit data map(from: a) if(b > g) nowait
201 
202 #pragma omp target exit data map(from: c) nowait
203 // CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
204 
205 #pragma omp target exit data map(release: c) nowait if(b>g)
206 // CHECK-NEXT: #pragma omp target exit data map(release: c) nowait if(b > g)
207 
208 #pragma omp target exit data nowait map(from: x[0:10], c)
209 // CHECK-NEXT: #pragma omp target exit data nowait map(from: x[0:10],c)
210 
211 #pragma omp target exit data nowait map(from: c) map(release: d)
212 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
213 
214 #pragma omp target exit data nowait map(always,release: e)
215 // CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
216 
217 #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: a)
218 // CHECK:      #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: a)
219 
220 #pragma omp target exit data nowait map(from: a) depend(in : argc,argv[i:argc],x[:]) if (target exit data: b)
221 // CHECK: #pragma omp target exit data nowait map(from: a) depend(in : argc,argv[i:argc],x[:]) if(target exit data: b)
222 
223 #pragma omp target exit data map(from: a) if (b > g) nowait depend(in : argc,argv[i:argc],x[:])
224 // CHECK: #pragma omp target exit data map(from: a) if(b > g) nowait depend(in : argc,argv[i:argc],x[:])
225 
226 #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
227 // CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
228 
229 #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) map(release: c) nowait if(b>g)
230 // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) map(release: c) nowait if(b > g)
231 
232 #pragma omp target exit data nowait map(from: x[0:10], c) depend(in : argc,argv[i:argc],x[:])
233 // CHECK-NEXT: #pragma omp target exit data nowait map(from: x[0:10],c) depend(in : argc,argv[i:argc],x[:])
234 
235 #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
236 // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d)
237 
238 #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(always,release: e)
239 // CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(always,release: e)
240 
241   return tmain<int, 5>(argc, &argc) + tmain<char, 1>(argv[0][0], argv[0]);
242 }
243 
244 #endif
245