[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / target_teams_default_messages.cpp
blob381f7518b92d37501a893a86cf0c0a170d3d9e08
1 // RUN: %clang_cc1 -verify -fopenmp -o - %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd -o - %s -Wuninitialized
5 // RUN: %clang_cc1 -verify -fopenmp-version=50 -DOMP50 -fopenmp -o - %s -Wuninitialized
7 // RUN: %clang_cc1 -verify -fopenmp-version=50 -DOMP50 -fopenmp-simd -o - %s -Wuninitialized
9 void foo();
11 namespace {
12 static int y = 0;
14 static int x = 0;
16 int main(int argc, char **argv) {
17 #pragma omp target teams default // expected-error {{expected '(' after 'default'}}
18 foo();
19 #pragma omp target teams default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
20 foo();
21 #pragma omp target teams default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
22 foo();
23 #pragma omp target teams default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}
24 foo();
25 #pragma omp target teams default (shared), default(shared) // expected-error {{directive '#pragma omp target teams' cannot contain more than one 'default' clause}}
26 foo();
27 #pragma omp target teams default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}
28 foo();
30 #pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
31 ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
33 #pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}}
34 #pragma omp parallel default(shared)
35 ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
37 #ifdef OMP50
38 #pragma omp target teams default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}
40 ++x;
41 ++y;
43 #pragma omp target teams default(private) // expected-error {{data-sharing attribute 'private' in 'default' clause requires OpenMP version 5.1 or above}}
45 ++x;
46 ++y;
48 #endif // OMP50
50 return 0;