|
82 | 82 | // RUN: (case=CASE_INHERITED_SUBARRAY_PRESENT not-crash-if-fail= )
|
83 | 83 | // RUN: (case=CASE_INHERITED_SUBARRAY_ABSENT not-crash-if-fail= )
|
84 | 84 | // RUN: }
|
| 85 | +// RUN: echo '#define FOREACH_CASE(Macro) \' > %t-cases.h |
| 86 | +// RUN: %for cases { |
| 87 | +// RUN: echo ' Macro(%[case]) \' >> %t-cases.h |
| 88 | +// RUN: } |
| 89 | +// RUN: echo ' /*end of FOREACH_CASE*/' >> %t-cases.h |
85 | 90 |
|
86 | 91 | // Check -ast-dump before and after AST serialization.
|
87 | 92 | //
|
|
90 | 95 | //
|
91 | 96 | // RUN: %for no-create-opts {
|
92 | 97 | // RUN: %clang -Xclang -verify -Xclang -ast-dump -fsyntax-only -fopenacc %s \
|
93 |
| -// RUN: %acc-includes %[no-create-opt] \ |
| 98 | +// RUN: %acc-includes %[no-create-opt] -DCASES_HEADER='"%t-cases.h"' \ |
94 | 99 | // RUN: | FileCheck -check-prefixes=DMP,DMP-%[noAlloc-or-alloc] %s
|
95 | 100 | // RUN: %clang -Xclang -verify -fopenacc -emit-ast -o %t.ast %s \
|
96 |
| -// RUN: %acc-includes %[no-create-opt] |
| 101 | +// RUN: %acc-includes %[no-create-opt] -DCASES_HEADER='"%t-cases.h"' |
97 | 102 | // RUN: %clang_cc1 -ast-dump-all %t.ast \
|
98 | 103 | // RUN: | FileCheck -check-prefixes=DMP,DMP-%[noAlloc-or-alloc] %s
|
99 | 104 | // RUN: }
|
|
104 | 109 | // more than sufficient to show it's working for the no_create clause.
|
105 | 110 | //
|
106 | 111 | // RUN: %clang -Xclang -verify -Xclang -ast-print -fsyntax-only %acc-includes \
|
107 |
| -// RUN: %s \ |
| 112 | +// RUN: -DCASES_HEADER='"%t-cases.h"' %s \ |
108 | 113 | // RUN: | FileCheck -check-prefixes=PRT %s
|
109 | 114 | //
|
110 | 115 | // TODO: If lit were to support %for inside a %data, we could iterate prt-opts
|
|
133 | 138 | // RUN: %for no-create-opts {
|
134 | 139 | // RUN: %for prt-args {
|
135 | 140 | // RUN: %clang -Xclang -verify %[prt] %[no-create-opt] %acc-includes \
|
136 |
| -// RUN: %t-acc.c -Wno-openacc-omp-map-hold \ |
| 141 | +// RUN: -DCASES_HEADER='"%t-cases.h"' %t-acc.c \ |
| 142 | +// RUN: -Wno-openacc-omp-map-hold \ |
137 | 143 | // RUN: | FileCheck -check-prefixes=%[prt-chk] \
|
138 | 144 | // RUN: -DNO_CREATE_MT=%[no-create-mt] \
|
139 | 145 | // RUN: -DINHERITED_NO_CREATE_MT=%[inherited-no-create-mt] %s
|
|
148 | 154 | //
|
149 | 155 | // RUN: %for no-create-opts {
|
150 | 156 | // RUN: %clang -Xclang -verify -fopenacc %[no-create-opt] -emit-ast \
|
151 |
| -// RUN: %acc-includes -o %t.ast %t-acc.c |
| 157 | +// RUN: %acc-includes -DCASES_HEADER='"%t-cases.h"' -o %t.ast %t-acc.c |
152 | 158 | // RUN: %for prt-args {
|
153 | 159 | // RUN: %clang %[prt] %t.ast 2>&1 \
|
154 | 160 | // RUN: | FileCheck -check-prefixes=%[prt-chk] \
|
|
170 | 176 | // RUN: %for tgts {
|
171 | 177 | // RUN: %for prt-opts {
|
172 | 178 | // RUN: %[run-if] %clang -Xclang -verify %[prt-opt]=omp \
|
173 |
| -// RUN: %[no-create-opt] %acc-includes %s > %t-omp.c \ |
| 179 | +// RUN: %[no-create-opt] %acc-includes \ |
| 180 | +// RUN: -DCASES_HEADER='"%t-cases.h"' %s > %t-omp.c \ |
174 | 181 | // RUN: -Wno-openacc-omp-map-hold
|
175 | 182 | // RUN: %[run-if] echo "// expected""-no-diagnostics" >> %t-omp.c
|
176 | 183 | // RUN: %[run-if] %clang -Xclang -verify -fopenmp %fopenmp-version \
|
177 |
| -// RUN: %[tgt-cflags] %acc-includes -o %t.exe %t-omp.c %acc-libs |
| 184 | +// RUN: %[tgt-cflags] %acc-includes \ |
| 185 | +// RUN: -DCASES_HEADER='"%t-cases.h"' -o %t.exe %t-omp.c \ |
| 186 | +// RUN: %acc-libs |
178 | 187 | // RUN: %for cases {
|
179 | 188 | // RUN: %[run-if] %[not-crash-if-fail] %t.exe %[case] > %t.out 2>&1
|
180 | 189 | // RUN: %[run-if] FileCheck -input-file %t.out %s \
|
|
191 | 200 | // RUN: %for no-create-opts {
|
192 | 201 | // RUN: %for tgts {
|
193 | 202 | // RUN: %[run-if] %clang -Xclang -verify -fopenacc %[no-create-opt] \
|
194 |
| -// RUN: %[tgt-cflags] %acc-includes -o %t.exe %s |
195 |
| -// RUN: rm -f %t.actual-cases && touch %t.actual-cases |
| 203 | +// RUN: %[tgt-cflags] %acc-includes \ |
| 204 | +// RUN: -DCASES_HEADER='"%t-cases.h"' -o %t.exe %s |
196 | 205 | // RUN: %for cases {
|
197 | 206 | // RUN: %[run-if] %[not-crash-if-fail] %t.exe %[case] > %t.out 2>&1
|
198 | 207 | // RUN: %[run-if] FileCheck -input-file %t.out %s \
|
199 | 208 | // RUN: -match-full-lines -allow-empty \
|
200 | 209 | // RUN: -check-prefixes=EXE%[host],EXE-%[case]%[host] \
|
201 | 210 | // RUN: -check-prefixes=EXE-%[case]-%[noAlloc-or-alloc]%[host]
|
202 |
| -// RUN: echo '%[case]' >> %t.actual-cases |
203 | 211 | // RUN: }
|
204 | 212 | // RUN: }
|
205 | 213 | // RUN: }
|
206 | 214 |
|
207 |
| -// Make sure %data cases didn't omit any cases defined in the code. |
208 |
| -// |
209 |
| -// RUN: %t.exe -dump-cases > %t.expected-cases |
210 |
| -// RUN: diff -u %t.expected-cases %t.actual-cases >&2 |
211 |
| - |
212 | 215 | // END.
|
213 | 216 |
|
214 | 217 | // expected-no-diagnostics
|
|
217 | 220 | #include <stdio.h>
|
218 | 221 | #include <string.h>
|
219 | 222 |
|
220 |
| -#define FOREACH_CASE(Macro) \ |
221 |
| - Macro(CASE_DATA_SCALAR_PRESENT) \ |
222 |
| - Macro(CASE_DATA_SCALAR_ABSENT) \ |
223 |
| - Macro(CASE_DATA_ARRAY_PRESENT) \ |
224 |
| - Macro(CASE_DATA_ARRAY_ABSENT) \ |
225 |
| - Macro(CASE_DATA_SUBARRAY_PRESENT) \ |
226 |
| - Macro(CASE_DATA_SUBARRAY_DISJOINT) \ |
227 |
| - Macro(CASE_DATA_SUBARRAY_OVERLAP_START) \ |
228 |
| - Macro(CASE_DATA_SUBARRAY_OVERLAP_END) \ |
229 |
| - Macro(CASE_DATA_SUBARRAY_CONCAT2) \ |
230 |
| - Macro(CASE_PARALLEL_SCALAR_PRESENT) \ |
231 |
| - Macro(CASE_PARALLEL_SCALAR_ABSENT) \ |
232 |
| - Macro(CASE_PARALLEL_ARRAY_PRESENT) \ |
233 |
| - Macro(CASE_PARALLEL_ARRAY_ABSENT) \ |
234 |
| - Macro(CASE_PARALLEL_SUBARRAY_PRESENT) \ |
235 |
| - Macro(CASE_PARALLEL_SUBARRAY_DISJOINT) \ |
236 |
| - Macro(CASE_PARALLEL_SUBARRAY_OVERLAP_START) \ |
237 |
| - Macro(CASE_PARALLEL_SUBARRAY_OVERLAP_END) \ |
238 |
| - Macro(CASE_PARALLEL_SUBARRAY_CONCAT2) \ |
239 |
| - Macro(CASE_PARALLEL_LOOP_SCALAR_PRESENT) \ |
240 |
| - Macro(CASE_PARALLEL_LOOP_SCALAR_ABSENT) \ |
241 |
| - Macro(CASE_CONST_PRESENT) \ |
242 |
| - Macro(CASE_CONST_ABSENT) \ |
243 |
| - Macro(CASE_INHERITED_PRESENT) \ |
244 |
| - Macro(CASE_INHERITED_ABSENT) \ |
245 |
| - Macro(CASE_INHERITED_SUBARRAY_PRESENT) \ |
246 |
| - Macro(CASE_INHERITED_SUBARRAY_ABSENT) |
| 223 | +#include CASES_HEADER |
247 | 224 |
|
248 | 225 | enum Case {
|
249 | 226 | #define AddCase(CaseName) \
|
@@ -294,11 +271,6 @@ int main(int argc, char *argv[]) {
|
294 | 271 | fprintf(stderr, "expected one argument\n");
|
295 | 272 | return 1;
|
296 | 273 | }
|
297 |
| - if (!strcmp(argv[1], "-dump-cases")) { |
298 |
| - for (int i = 0; i < CASE_END; ++i) |
299 |
| - printf("%s\n", CaseNames[i]); |
300 |
| - return 0; |
301 |
| - } |
302 | 274 | enum Case selectedCase;
|
303 | 275 | for (selectedCase = 0; selectedCase < CASE_END; ++selectedCase) {
|
304 | 276 | if (!strcmp(argv[1], CaseNames[selectedCase]))
|
|
0 commit comments