[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / tile_messages.cpp
blob5268dfe97e0c8c39bcba69cdb8f778b1b2062896
1 // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++17 -fopenmp -fsyntax-only -Wuninitialized -verify %s
3 void func() {
5 // expected-error@+1 {{expected '('}}
6 #pragma omp tile sizes
9 // expected-error@+2 {{expected expression}}
10 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
11 #pragma omp tile sizes(
14 // expected-error@+1 {{expected expression}}
15 #pragma omp tile sizes()
18 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
19 #pragma omp tile sizes(5
20 for (int i = 0; i < 7; ++i);
22 // expected-error@+2 {{expected expression}}
23 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
24 #pragma omp tile sizes(5,
27 // expected-error@+1 {{expected expression}}
28 #pragma omp tile sizes(5,)
31 // expected-error@+2 {{expected expression}}
32 // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
33 #pragma omp tile sizes(5+
36 // expected-error@+1 {{expected expression}}
37 #pragma omp tile sizes(5+)
40 // expected-error@+1 {{expected expression}}
41 #pragma omp tile sizes(for)
44 // expected-error@+1 {{argument to 'sizes' clause must be a strictly positive integer value}}
45 #pragma omp tile sizes(0)
46 for (int i = 0; i < 7; ++i)
49 // expected-warning@+2 {{extra tokens at the end of '#pragma omp tile' are ignored}}
50 // expected-error@+1 {{directive '#pragma omp tile' requires the 'sizes' clause}}
51 #pragma omp tile foo
54 // expected-error@+1 {{directive '#pragma omp tile' cannot contain more than one 'sizes' clause}}
55 #pragma omp tile sizes(5) sizes(5)
56 for (int i = 0; i < 7; ++i)
59 // expected-error@+1 {{unexpected OpenMP clause 'collapse' in directive '#pragma omp tile'}}
60 #pragma omp tile sizes(5) collapse(2)
61 for (int i = 0; i < 7; ++i)
65 // expected-error@+2 {{expected statement}}
66 #pragma omp tile sizes(5)
69 // expected-error@+2 {{statement after '#pragma omp tile' must be a for loop}}
70 #pragma omp tile sizes(5)
71 int b = 0;
73 // expected-error@+3 {{statement after '#pragma omp tile' must be a for loop}}
74 #pragma omp tile sizes(5,5)
75 for (int i = 0; i < 7; ++i)
78 // expected-error@+2 {{statement after '#pragma omp tile' must be a for loop}}
79 #pragma omp tile sizes(5,5)
80 for (int i = 0; i < 7; ++i) {
81 int k = 3;
82 for (int j = 0; j < 7; ++j)
86 // expected-error@+3 {{expected loop invariant expression}}
87 #pragma omp tile sizes(5,5)
88 for (int i = 0; i < 7; ++i)
89 for (int j = i; j < 7; ++j)
92 // expected-error@+3 {{expected loop invariant expression}}
93 #pragma omp tile sizes(5,5)
94 for (int i = 0; i < 7; ++i)
95 for (int j = 0; j < i; ++j)
98 // expected-error@+3 {{expected loop invariant expression}}
99 #pragma omp tile sizes(5,5)
100 for (int i = 0; i < 7; ++i)
101 for (int j = 0; j < i; ++j)
104 // expected-error@+5 {{expected 3 for loops after '#pragma omp for', but found only 2}}
105 // expected-note@+1 {{as specified in 'collapse' clause}}
106 #pragma omp for collapse(3)
107 #pragma omp tile sizes(5)
108 for (int i = 0; i < 7; ++i)
111 // expected-error@+2 {{statement after '#pragma omp tile' must be a for loop}}
112 #pragma omp tile sizes(5)
113 #pragma omp for
114 for (int i = 0; i < 7; ++i)
117 // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', '>=', or '!=') of loop variable 'i'}}
118 #pragma omp tile sizes(5)
119 for (int i = 0; i/3<7; ++i)
122 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'struct S'}}
123 struct S{} s;
124 #pragma omp tile sizes(s)
125 for (int i = 0; i < 7; ++i)
130 template <typename T>
131 static void templated_func() {
132 // In a template context, but expression itself not instantiation-dependent
134 // expected-error@+1 {{argument to 'sizes' clause must be a strictly positive integer value}}
135 #pragma omp tile sizes(0)
136 for (int i = 0; i < 7; ++i)
140 template <int S>
141 static void templated_func_value_dependent() {
142 // expected-error@+1 {{argument to 'sizes' clause must be a strictly positive integer value}}
143 #pragma omp tile sizes(S)
144 for (int i = 0; i < 7; ++i)
148 template <typename T>
149 static void templated_func_type_dependent() {
150 constexpr T s = 0;
151 // expected-error@+1 {{argument to 'sizes' clause must be a strictly positive integer value}}
152 #pragma omp tile sizes(s)
153 for (int i = 0; i < 7; ++i)
157 void template_inst() {
158 templated_func<int>();
159 // expected-note@+1 {{in instantiation of function template specialization 'templated_func_value_dependent<0>' requested here}}
160 templated_func_value_dependent<0>();
161 // expected-note@+1 {{in instantiation of function template specialization 'templated_func_type_dependent<int>' requested here}}
162 templated_func_type_dependent<int>();