[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / flush_ast_print.cpp
blob9578ada020227a7643c2a5f143b0617a7b87e2ef
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 flush
19 #pragma omp flush acq_rel
20 #pragma omp flush acquire
21 #pragma omp flush release
22 #pragma omp flush(a)
23 return a + argc;
25 // CHECK: static T a;
26 // CHECK-NEXT: #pragma omp flush{{$}}
27 // CHECK-NEXT: #pragma omp flush acq_rel{{$}}
28 // CHECK-NEXT: #pragma omp flush acquire{{$}}
29 // CHECK-NEXT: #pragma omp flush release{{$}}
30 // CHECK-NEXT: #pragma omp flush (a)
31 // CHECK: static int a;
32 // CHECK-NEXT: #pragma omp flush
33 // CHECK-NEXT: #pragma omp flush acq_rel{{$}}
34 // CHECK-NEXT: #pragma omp flush acquire{{$}}
35 // CHECK-NEXT: #pragma omp flush release{{$}}
36 // CHECK-NEXT: #pragma omp flush (a)
37 // CHECK: static char a;
38 // CHECK-NEXT: #pragma omp flush
39 // CHECK-NEXT: #pragma omp flush acq_rel{{$}}
40 // CHECK-NEXT: #pragma omp flush acquire{{$}}
41 // CHECK-NEXT: #pragma omp flush release{{$}}
42 // CHECK-NEXT: #pragma omp flush (a)
44 int main(int argc, char **argv) {
45 static int a;
46 // CHECK: static int a;
47 #pragma omp flush
48 #pragma omp flush acq_rel
49 #pragma omp flush acquire
50 #pragma omp flush release
51 #pragma omp flush(a)
52 // CHECK-NEXT: #pragma omp flush
53 // CHECK-NEXT: #pragma omp flush acq_rel
54 // CHECK-NEXT: #pragma omp flush acquire{{$}}
55 // CHECK-NEXT: #pragma omp flush release
56 // CHECK-NEXT: #pragma omp flush (a)
57 return tmain(argc) + tmain(argv[0][0]) + a;
60 #endif