]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/sections_ast_print.cpp
Vendor import of clang trunk r238337:
[FreeBSD/FreeBSD.git] / test / OpenMP / sections_ast_print.cpp
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 -fsyntax-only -verify %s -ast-print | FileCheck %s
4 // expected-no-diagnostics
5
6 #ifndef HEADER
7 #define HEADER
8
9 void foo() {}
10
11 template <class T, int N>
12 T tmain(T argc) {
13   T b = argc, c, d, e, f, g;
14   static T a;
15 // CHECK: static T a;
16 #pragma omp parallel
17 #pragma omp sections private(argc, b), firstprivate(c, d), lastprivate(d, f) reduction(- : g) nowait
18   {
19     foo();
20   }
21   // CHECK-NEXT: #pragma omp parallel
22   // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait
23   // CHECK-NEXT: {
24   // CHECK-NEXT: foo();
25   // CHECK-NEXT: }
26   return T();
27 }
28
29 int main(int argc, char **argv) {
30   int b = argc, c, d, e, f, g;
31   static int a;
32 // CHECK: static int a;
33 #pragma omp parallel
34 #pragma omp sections private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait
35   {
36 #pragma omp section
37     foo();
38 #pragma omp section
39     foo();
40   }
41   // CHECK-NEXT: #pragma omp parallel
42   // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait
43   // CHECK-NEXT: {
44   // CHECK-NEXT: #pragma omp section
45   // CHECK-NEXT: foo();
46   // CHECK-NEXT: #pragma omp section
47   // CHECK-NEXT: foo();
48   // CHECK-NEXT: }
49   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
50 }
51
52 #endif