[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / distribute_parallel_for_simd_if_messages.cpp
blob6cf18faf0a87fc33dda83aa8efe60f54163a7593
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ferror-limit 100 %s -Wuninitialized
5 void foo() {
8 bool foobool(int argc) {
9 return argc;
12 void xxx(int argc) {
13 int cond; // expected-note {{initialize the variable 'cond' to silence this warning}}
14 #pragma omp distribute parallel for simd if(cond) // expected-warning {{variable 'cond' is uninitialized when used here}}
15 for (int i = 0; i < 10; ++i)
19 struct S1; // expected-note {{declared here}}
21 template <class T, class S> // expected-note {{declared here}}
22 int tmain(T argc, S **argv) {
23 T i, k;
24 #pragma omp target
25 #pragma omp teams
26 #pragma omp distribute parallel for simd if // expected-error {{expected '(' after 'if'}}
27 for (i = 0; i < argc; ++i) foo();
28 #pragma omp target
29 #pragma omp teams
30 #pragma omp distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
31 for (i = 0; i < argc; ++i) foo();
32 #pragma omp target
33 #pragma omp teams
34 #pragma omp distribute parallel for simd if () // expected-error {{expected expression}}
35 for (i = 0; i < argc; ++i) foo();
36 #pragma omp target
37 #pragma omp teams
38 #pragma omp distribute parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
39 for (i = 0; i < argc; ++i) foo();
40 #pragma omp target
41 #pragma omp teams
42 #pragma omp distribute parallel for simd if (k)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
43 for (i = 0; i < argc; ++i) foo();
44 #pragma omp target
45 #pragma omp teams
46 #pragma omp distribute parallel for simd if (argc > 0 ? argv[1] : argv[2])
47 for (i = 0; i < argc; ++i) foo();
48 #pragma omp target
49 #pragma omp teams
50 #pragma omp distribute parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause}}
51 for (i = 0; i < argc; ++i) foo();
52 #pragma omp target
53 #pragma omp teams
54 #pragma omp distribute parallel for simd if (S) // expected-error {{'S' does not refer to a value}}
55 for (i = 0; i < argc; ++i) foo();
56 #pragma omp target
57 #pragma omp teams
58 #pragma omp distribute parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
59 for (i = 0; i < argc; ++i) foo();
60 #pragma omp target
61 #pragma omp teams
62 #pragma omp distribute parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
63 for (i = 0; i < argc; ++i) foo();
64 #pragma omp target
65 #pragma omp teams
66 #pragma omp distribute parallel for simd if(argc)
67 for (i = 0; i < argc; ++i) foo();
68 #pragma omp target
69 #pragma omp teams
70 #pragma omp distribute parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71 for (i = 0; i < argc; ++i) foo();
72 #pragma omp target
73 #pragma omp teams
74 #pragma omp distribute parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
75 for (i = 0; i < argc; ++i) foo();
76 #pragma omp target
77 #pragma omp teams
78 #pragma omp distribute parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
79 for (i = 0; i < argc; ++i) foo();
80 #pragma omp target
81 #pragma omp teams
82 #pragma omp distribute parallel for simd if(parallel : argc)
83 for (i = 0; i < argc; ++i) foo();
84 #pragma omp target
85 #pragma omp teams
86 #pragma omp distribute parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute parallel for simd'}}
87 for (i = 0; i < argc; ++i) foo();
88 #pragma omp target
89 #pragma omp teams
90 #pragma omp distribute parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
91 for (i = 0; i < argc; ++i) foo();
92 #pragma omp target
93 #pragma omp teams
94 #pragma omp distribute parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
95 for (i = 0; i < argc; ++i) foo();
96 #pragma omp target
97 #pragma omp teams
98 #pragma omp distribute parallel for simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp distribute parallel for simd'}}
99 for (i = 0; i < argc; ++i) foo();
101 return 0;
104 int main(int argc, char **argv) {
105 int i, k;
106 #pragma omp target
107 #pragma omp teams
108 #pragma omp distribute parallel for simd if // expected-error {{expected '(' after 'if'}}
109 for (i = 0; i < argc; ++i) foo();
110 #pragma omp target
111 #pragma omp teams
112 #pragma omp distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
113 for (i = 0; i < argc; ++i) foo();
114 #pragma omp target
115 #pragma omp teams
116 #pragma omp distribute parallel for simd if () // expected-error {{expected expression}}
117 for (i = 0; i < argc; ++i) foo();
118 #pragma omp target
119 #pragma omp teams
120 #pragma omp distribute parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
121 for (i = 0; i < argc; ++i) foo();
122 #pragma omp target
123 #pragma omp teams
124 #pragma omp distribute parallel for simd if (k)) // expected-warning {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}}
125 for (i = 0; i < argc; ++i) foo();
126 #pragma omp target
127 #pragma omp teams
128 #pragma omp distribute parallel for simd if (argc > 0 ? argv[1] : argv[2])
129 for (i = 0; i < argc; ++i) foo();
130 #pragma omp target
131 #pragma omp teams
132 #pragma omp distribute parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause}}
133 for (i = 0; i < argc; ++i) foo();
134 #pragma omp target
135 #pragma omp teams
136 #pragma omp distribute parallel for simd if (S1) // expected-error {{'S1' does not refer to a value}}
137 for (i = 0; i < argc; ++i) foo();
138 #pragma omp target
139 #pragma omp teams
140 #pragma omp distribute parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
141 for (i = 0; i < argc; ++i) foo();
142 #pragma omp target
143 #pragma omp teams
144 #pragma omp distribute parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
145 for (i = 0; i < argc; ++i) foo();
146 #pragma omp target
147 #pragma omp teams
148 #pragma omp distribute parallel for simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
149 for (i = 0; i < argc; ++i) foo();
150 #pragma omp target
151 #pragma omp teams
152 #pragma omp distribute parallel for simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
153 for (i = 0; i < argc; ++i) foo();
154 #pragma omp target
155 #pragma omp teams
156 #pragma omp distribute parallel for simd if(parallel // expected-error {{use of undeclared identifier 'parallel'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
157 for (i = 0; i < argc; ++i) foo();
158 #pragma omp target
159 #pragma omp teams
160 #pragma omp distribute parallel for simd if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
161 for (i = 0; i < argc; ++i) foo();
162 #pragma omp target
163 #pragma omp teams
164 #pragma omp distribute parallel for simd if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
165 for (i = 0; i < argc; ++i) foo();
166 #pragma omp target
167 #pragma omp teams
168 #pragma omp distribute parallel for simd if(parallel : argc)
169 for (i = 0; i < argc; ++i) foo();
170 #pragma omp target
171 #pragma omp teams
172 #pragma omp distribute parallel for simd if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp distribute parallel for simd'}}
173 for (i = 0; i < argc; ++i) foo();
174 #pragma omp target
175 #pragma omp teams
176 #pragma omp distribute parallel for simd if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'if' clause with 'parallel' name modifier}}
177 for (i = 0; i < argc; ++i) foo();
178 #pragma omp target
179 #pragma omp teams
180 #pragma omp distribute parallel for simd if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
181 for (i = 0; i < argc; ++i) foo();
182 #pragma omp target
183 #pragma omp teams
184 #pragma omp distribute parallel for simd if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp distribute parallel for simd'}}
185 for (i = 0; i < argc; ++i) foo();
187 return tmain(argc, argv);