xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/sections_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, int N>
tmain(T argc)12*0a6a1f1dSLionel Sambuc T tmain(T argc) {
13*0a6a1f1dSLionel Sambuc   T b = argc, c, d, e, f, g;
14*0a6a1f1dSLionel Sambuc   static T a;
15*0a6a1f1dSLionel Sambuc // CHECK: static T a;
16*0a6a1f1dSLionel Sambuc #pragma omp parallel
17*0a6a1f1dSLionel Sambuc #pragma omp sections private(argc, b), firstprivate(c, d), lastprivate(d, f) reduction(- : g) nowait
18*0a6a1f1dSLionel Sambuc   {
19*0a6a1f1dSLionel Sambuc     foo();
20*0a6a1f1dSLionel Sambuc   }
21*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: #pragma omp parallel
22*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait
23*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: {
24*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: foo();
25*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: }
26*0a6a1f1dSLionel Sambuc   return T();
27*0a6a1f1dSLionel Sambuc }
28*0a6a1f1dSLionel Sambuc 
main(int argc,char ** argv)29*0a6a1f1dSLionel Sambuc int main(int argc, char **argv) {
30*0a6a1f1dSLionel Sambuc   int b = argc, c, d, e, f, g;
31*0a6a1f1dSLionel Sambuc   static int a;
32*0a6a1f1dSLionel Sambuc // CHECK: static int a;
33*0a6a1f1dSLionel Sambuc #pragma omp parallel
34*0a6a1f1dSLionel Sambuc #pragma omp sections private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait
35*0a6a1f1dSLionel Sambuc   {
36*0a6a1f1dSLionel Sambuc #pragma omp section
37*0a6a1f1dSLionel Sambuc     foo();
38*0a6a1f1dSLionel Sambuc #pragma omp section
39*0a6a1f1dSLionel Sambuc     foo();
40*0a6a1f1dSLionel Sambuc   }
41*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: #pragma omp parallel
42*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait
43*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: {
44*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: #pragma omp section
45*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: foo();
46*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: #pragma omp section
47*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: foo();
48*0a6a1f1dSLionel Sambuc   // CHECK-NEXT: }
49*0a6a1f1dSLionel Sambuc   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
50*0a6a1f1dSLionel Sambuc }
51*0a6a1f1dSLionel Sambuc 
52*0a6a1f1dSLionel Sambuc #endif
53