llvm-project
35 строк · 1.6 Кб
1// RUN: %clang_cc1 -std=c++11 -verify %s
2
3// Note that this puts the expected lines before the directives to work around
4// limitations in the -verify mode.
5
6void test(int *List, int Length) {
7int i = 0;
8
9#pragma clang loop vectorize(assume_safety)
10#pragma clang loop interleave(assume_safety)
11while (i + 1 < Length) {
12List[i] = i;
13}
14
15/* expected-error {{expected ')'}} */ #pragma clang loop vectorize(assume_safety
16/* expected-error {{expected ')'}} */ #pragma clang loop interleave(assume_safety
17
18/* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(assume_safety)
19/* expected-error {{invalid argument; expected 'enable' or 'disable'}} */ #pragma clang loop distribute(assume_safety)
20
21/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop vectorize(badidentifier)
22/* expected-error {{invalid argument; expected 'enable', 'assume_safety' or 'disable'}} */ #pragma clang loop interleave(badidentifier)
23/* expected-error {{invalid argument; expected 'enable', 'full' or 'disable'}} */ #pragma clang loop unroll(badidentifier)
24while (i-7 < Length) {
25List[i] = i;
26}
27
28#pragma clang loop vectorize(enable)
29/* expected-error {{duplicate directives 'vectorize(enable)' and 'vectorize(assume_safety)'}} */ #pragma clang loop vectorize(assume_safety)
30#pragma clang loop interleave(enable)
31/* expected-error {{duplicate directives 'interleave(enable)' and 'interleave(assume_safety)'}} */ #pragma clang loop interleave(assume_safety)
32while (i-9 < Length) {
33List[i] = i;
34}
35}
36