[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / teams_distribute_simd_dist_schedule_messages.cpp
blob424797576837f40dcea5bd2411a8f16f8eedf2cb
1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
5 void foo() {
8 bool foobool(int argc) {
9 return argc;
12 struct S1; // expected-note {{declared here}} expected-note {{declared here}}
14 template <class T, int N>
15 T tmain(T argc) {
16 T b = argc, c, d, e, f, g;
17 char ** argv;
18 static T a;
19 T z;
21 #pragma omp target
22 #pragma omp teams distribute simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
23 for (int i = 0; i < 10; ++i) foo();
25 #pragma omp target
26 #pragma omp teams distribute simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
27 for (int i = 0; i < 10; ++i) foo();
29 #pragma omp target
30 #pragma omp teams distribute simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
31 for (int i = 0; i < 10; ++i) foo();
33 #pragma omp target
34 #pragma omp teams distribute simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
35 for (int i = 0; i < 10; ++i) foo();
37 #pragma omp target
38 #pragma omp teams distribute simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
39 for (int i = 0; i < 10; ++i) foo();
41 #pragma omp target
42 #pragma omp teams distribute simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp teams distribute simd' are ignored}}
43 for (int i = 0; i < 10; ++i) foo();
45 #pragma omp target
46 #pragma omp teams distribute simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
47 for (int i = 0; i < 10; ++i) foo();
49 #pragma omp target
50 #pragma omp teams distribute simd dist_schedule (static), dist_schedule (static, z) // expected-error {{directive '#pragma omp teams distribute simd' cannot contain more than one 'dist_schedule' clause}}
51 for (int i = 0; i < 10; ++i) foo();
53 #pragma omp target
54 #pragma omp teams distribute simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
55 for (int i = 0; i < 10; ++i) foo();
57 #pragma omp target
58 #pragma omp teams distribute simd dist_schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error3 {{expression must have integral or unscoped enumeration type, not 'char *'}}
59 for (int i = 0; i < 10; ++i) foo();
61 return T();
64 int main(int argc, char **argv) {
65 int z;
66 #pragma omp target
67 #pragma omp teams distribute simd dist_schedule // expected-error {{expected '(' after 'dist_schedule'}}
68 for (int i = 0; i < 10; ++i) foo();
70 #pragma omp target
71 #pragma omp teams distribute simd dist_schedule ( // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
72 for (int i = 0; i < 10; ++i) foo();
74 #pragma omp target
75 #pragma omp teams distribute simd dist_schedule () // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}}
76 for (int i = 0; i < 10; ++i) foo();
78 #pragma omp target
79 #pragma omp teams distribute simd dist_schedule (static // expected-error {{expected ')'}} expected-note {{to match this '('}}
80 for (int i = 0; i < 10; ++i) foo();
82 #pragma omp target
83 #pragma omp teams distribute simd dist_schedule (static, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
84 for (int i = 0; i < 10; ++i) foo();
86 #pragma omp target
87 #pragma omp teams distribute simd dist_schedule (argc)) // expected-error {{expected 'static' in OpenMP clause 'dist_schedule'}} expected-warning {{extra tokens at the end of '#pragma omp teams distribute simd' are ignored}}
88 for (int i = 0; i < 10; ++i) foo();
90 #pragma omp target
91 #pragma omp teams distribute simd dist_schedule (static, argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
92 for (int i = 0; i < 10; ++i) foo();
94 #pragma omp target
95 #pragma omp teams distribute simd dist_schedule (static), dist_schedule (static, 1 + z) // expected-error {{directive '#pragma omp teams distribute simd' cannot contain more than one 'dist_schedule' clause}}
96 for (int i = 0; i < 10; ++i) foo();
98 #pragma omp target
99 #pragma omp teams distribute simd dist_schedule (static, S1) // expected-error {{'S1' does not refer to a value}}
100 for (int i = 0; i < 10; ++i) foo();
102 #pragma omp target
103 #pragma omp teams distribute simd dist_schedule (static, argv[1]=2) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
104 for (int i = 0; i < 10; ++i) foo();
106 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}}