xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/flush_ast_print.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ast-print %s | FileCheck %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -emit-pch -o %t %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
4*0a6a1f1dSLionel Sambuc // expected-no-diagnostics
5*0a6a1f1dSLionel Sambuc 
6*0a6a1f1dSLionel Sambuc #ifndef HEADER
7*0a6a1f1dSLionel Sambuc #define HEADER
8*0a6a1f1dSLionel Sambuc 
foo()9*0a6a1f1dSLionel Sambuc void foo() {}
10*0a6a1f1dSLionel Sambuc 
11*0a6a1f1dSLionel Sambuc template <class T>
tmain(T argc)12*0a6a1f1dSLionel Sambuc T tmain(T argc) {
13*0a6a1f1dSLionel Sambuc   static T a;
14*0a6a1f1dSLionel Sambuc #pragma omp flush
15*0a6a1f1dSLionel Sambuc #pragma omp flush(a)
16*0a6a1f1dSLionel Sambuc   return a + argc;
17*0a6a1f1dSLionel Sambuc }
18*0a6a1f1dSLionel Sambuc // CHECK:      static int a;
19*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush
20*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush (a)
21*0a6a1f1dSLionel Sambuc // CHECK:      static char a;
22*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush
23*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush (a)
24*0a6a1f1dSLionel Sambuc // CHECK:      static T a;
25*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush
26*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush (a)
27*0a6a1f1dSLionel Sambuc 
main(int argc,char ** argv)28*0a6a1f1dSLionel Sambuc int main(int argc, char **argv) {
29*0a6a1f1dSLionel Sambuc   static int a;
30*0a6a1f1dSLionel Sambuc // CHECK: static int a;
31*0a6a1f1dSLionel Sambuc #pragma omp flush
32*0a6a1f1dSLionel Sambuc #pragma omp flush(a)
33*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush
34*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp flush (a)
35*0a6a1f1dSLionel Sambuc   return tmain(argc) + tmain(argv[0][0]) + a;
36*0a6a1f1dSLionel Sambuc }
37*0a6a1f1dSLionel Sambuc 
38*0a6a1f1dSLionel Sambuc #endif
39