]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/sections_ast_print.cpp
Vendor import of clang trunk r290819:
[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 // CHECK: int main(int argc, char **argv) {
31   int b = argc, c, d, e, f, g;
32   static int a;
33 // CHECK: static int a;
34 #pragma omp parallel
35 #pragma omp sections private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait
36   {
37 #pragma omp section
38     foo();
39 #pragma omp section
40     foo();
41   }
42   // CHECK-NEXT: #pragma omp parallel
43   // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait
44   // CHECK-NEXT: {
45   // CHECK-NEXT: #pragma omp section
46   // CHECK-NEXT: foo();
47   // CHECK-NEXT: #pragma omp section
48   // CHECK-NEXT: foo();
49   // CHECK-NEXT: }
50   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
51 }
52
53 #endif