[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / report_default_DSA.cpp
blobd40cd06843db8191fc7a6e3726e6642254929802
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s
3 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s
5 // RUN: %clang_cc1 -verify -fopenmp %s
6 // RUN: %clang_cc1 -verify -fopenmp-simd %s
8 void foo(int x, int n) {
9 double vec[n];
10 for (int iter = 0; iter < x; iter++) {
11 #pragma omp target teams distribute parallel for map( \
12 from \
13 : vec [0:n]) default(none) // expected-note 4 {{explicit data sharing attribute requested here}}
14 // expected-error@+1 {{variable 'n' must have explicitly specified data sharing attributes}}
15 for (int ii = 0; ii < n; ii++) {
16 // expected-error@+3 {{variable 'iter' must have explicitly specified data sharing attributes}}
17 // expected-error@+2 {{variable 'vec' must have explicitly specified data sharing attributes}}
18 // expected-error@+1 {{variable 'x' must have explicitly specified data sharing attributes}}
19 vec[ii] = iter + ii + x;