xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/critical_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 
main(int argc,char ** argv)11*0a6a1f1dSLionel Sambuc int main (int argc, char **argv) {
12*0a6a1f1dSLionel Sambuc   int b = argc, c, d, e, f, g;
13*0a6a1f1dSLionel Sambuc   static int a;
14*0a6a1f1dSLionel Sambuc // CHECK: static int a;
15*0a6a1f1dSLionel Sambuc #pragma omp critical
16*0a6a1f1dSLionel Sambuc   a=2;
17*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp critical
18*0a6a1f1dSLionel Sambuc // CHECK-NEXT: a = 2;
19*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ++a;
20*0a6a1f1dSLionel Sambuc   ++a;
21*0a6a1f1dSLionel Sambuc #pragma omp critical  (the_name)
22*0a6a1f1dSLionel Sambuc   foo();
23*0a6a1f1dSLionel Sambuc // CHECK-NEXT: #pragma omp critical (the_name)
24*0a6a1f1dSLionel Sambuc // CHECK-NEXT: foo();
25*0a6a1f1dSLionel Sambuc // CHECK-NEXT: return 0;
26*0a6a1f1dSLionel Sambuc   return 0;
27*0a6a1f1dSLionel Sambuc }
28*0a6a1f1dSLionel Sambuc 
29*0a6a1f1dSLionel Sambuc #endif
30