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
23 S7(typename T::type v) : a(v) {
26 #pragma omp distribute parallel for private(a) private(this->a) private(T::a)
27 for (int k = 0; k < a.a; ++k)
30 S7 &operator=(S7 &s) {
33 #pragma omp distribute parallel for private(a) private(this->a)
34 for (int k = 0; k < s.a.a; ++k)
40 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(this->S::a)
41 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(T::a)
42 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a)
44 class S8 : public S7<S> {
51 #pragma omp distribute parallel for private(a) private(this->a) private(S7<S>::a)
52 for (int k = 0; k < a.a; ++k)
55 S8 &operator=(S8 &s) {
58 #pragma omp distribute parallel for private(a) private(this->a)
59 for (int k = 0; k < s.a.a; ++k)
65 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(this->S7<S>::a)
66 // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a)
68 template <class T, int N>
70 T b = argc, c, d, e, f, h;
74 #pragma omp threadprivate(g)
77 #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a)
78 // CHECK: #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g)
79 for (int i = 0; i < 2; ++i)
81 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
85 #pragma omp distribute parallel for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N)
86 for (int i = 0; i < 2; ++i)
87 for (int j = 0; j < 2; ++j)
88 for (int j = 0; j < 2; ++j)
89 for (int j = 0; j < 2; ++j)
90 for (int j = 0; j < 2; ++j)
91 for (int i = 0; i < 2; ++i)
92 for (int j = 0; j < 2; ++j)
93 for (int j = 0; j < 2; ++j)
94 for (int j = 0; j < 2; ++j)
95 for (int j = 0; j < 2; ++j)
97 // CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N)
98 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
99 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
100 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
101 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
102 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
103 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
104 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
105 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
106 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
107 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
112 int main(int argc, char **argv) {
113 int b = argc, c, d, e, f, h;
115 // CHECK: static int a;
117 #pragma omp threadprivate(g)
120 #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a)
121 // CHECK: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a)
122 for (int i = 0; i < 2; ++i)
124 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
125 // CHECK-NEXT: a = 2;
128 #pragma omp distribute parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) dist_schedule(static, b)
129 for (int i = 0; i < 10; ++i)
130 for (int j = 0; j < 10; ++j)
132 // CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) schedule(auto) if(argc) num_threads(a) default(shared) shared(e) reduction(+: h) dist_schedule(static, b)
133 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
134 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
136 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));