[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / pragma-loop-safety.cpp
blob1393cf747498684ad8bd9c364f43c1e2a6c6db92
1 // RUN: %clang_cc1 -std=c++11 -verify %s
3 // Note that this puts the expected lines before the directives to work around
4 // limitations in the -verify mode.
6 void test(int *List, int Length) {
7 int i = 0;
9 #pragma clang loop vectorize(assume_safety)
10 #pragma clang loop interleave(assume_safety)
11 while (i + 1 < Length) {
12 List[i] = i;
15 /* expected-error {{expected ')'}} */ #pragma clang loop vectorize(assume_safety
16 /* expected-error {{expected ')'}} */ #pragma clang loop interleave(assume_safety
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)
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)
24 while (i-7 < Length) {
25 List[i] = i;
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)
32 while (i-9 < Length) {
33 List[i] = i;