[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / taskwait_ast_print.cpp
blobb487bb4697a943e9ece18cc9c6e9427deddc49c7
1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 void foo() {}
15 template <class T>
16 T tmain(T argc) {
17 static T a;
18 #pragma omp taskwait
19 #pragma omp taskwait depend(in:a, argc)
20 return a + argc;
23 template <class T>
24 T ndmain(T argc) {
25 static T a;
26 #pragma omp taskwait
27 #pragma omp taskwait depend(in:a, argc) nowait
28 #pragma omp taskwait depend(in:a) depend(in:argc) nowait
29 return a + argc;
32 // CHECK: static T a;
33 // CHECK-NEXT: #pragma omp taskwait{{$}}
34 // CHECK-NEXT: #pragma omp taskwait depend(in : a,argc){{$}}
35 // CHECK: static int a;
36 // CHECK-NEXT: #pragma omp taskwait
37 // CHECK-NEXT: #pragma omp taskwait depend(in : a,argc){{$}}
38 // CHECK: static char a;
39 // CHECK-NEXT: #pragma omp taskwait
40 // CHECK-NEXT: #pragma omp taskwait depend(in : a,argc){{$}}
42 // CHECK: static T a;
43 // CHECK-NEXT: #pragma omp taskwait{{$}}
44 // CHECK-NEXT: #pragma omp taskwait depend(in : a,argc) nowait{{$}}
45 // CHECK-NEXT: #pragma omp taskwait depend(in : a) depend(in : argc) nowait{{$}}
46 // CHECK: static int a;
47 // CHECK-NEXT: #pragma omp taskwait
48 // CHECK-NEXT: #pragma omp taskwait depend(in : a,argc) nowait{{$}}
49 // CHECK-NEXT: #pragma omp taskwait depend(in : a) depend(in : argc) nowait{{$}}
50 // CHECK: static char a;
51 // CHECK-NEXT: #pragma omp taskwait
52 // CHECK-NEXT: #pragma omp taskwait depend(in : a,argc) nowait{{$}}
53 // CHECK-NEXT: #pragma omp taskwait depend(in : a) depend(in : argc) nowait{{$}}
55 int main(int argc, char **argv) {
56 static int a;
57 // CHECK: static int a;
58 #pragma omp taskwait
59 #pragma omp taskwait depend(out:a, argc)
60 // CHECK-NEXT: #pragma omp taskwait
61 // CHECK-NEXT: #pragma omp taskwait depend(out : a,argc)
62 return tmain(argc) + tmain(argv[0][0]) + a + ndmain(argc) + ndmain(argv[0][0]);
65 #endif