1 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
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 --check-prefix=CHECK --check-prefix=OMP50
4 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
5 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
6 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
7 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
8 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52
9 // RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
11 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
12 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
13 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
14 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -ast-print %s -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
15 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
16 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51
17 // expected-no-diagnostics
18 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
19 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52
20 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52
21 // expected-no-diagnostics
42 S7(typename
T::type v
) : a(v
) {
43 #pragma omp parallel for private(a) private(this->a) private(T::a)
44 for (int k
= 0; k
< a
.a
; ++k
)
47 S7
&operator=(S7
&s
) {
48 #pragma omp parallel for private(a) private(this->a)
49 for (int k
= 0; k
< s
.a
.a
; ++k
)
55 // CHECK: #pragma omp parallel for private(this->a) private(this->a) private(T::a){{$}}
56 // CHECK: #pragma omp parallel for private(this->a) private(this->a)
57 // CHECK: #pragma omp parallel for private(this->a) private(this->a) private(this->S::a)
59 class S8
: public S7
<S
> {
64 #pragma omp parallel for private(a) private(this->a) private(S7<S>::a)
65 for (int k
= 0; k
< a
.a
; ++k
)
68 S8
&operator=(S8
&s
) {
69 #pragma omp parallel for private(a) private(this->a)
70 for (int k
= 0; k
< s
.a
.a
; ++k
)
76 // CHECK: #pragma omp parallel for private(this->a) private(this->a) private(this->S7<S>::a)
77 // CHECK: #pragma omp parallel for private(this->a) private(this->a)
79 template <class T
, int N
>
81 T b
= argc
, c
, d
, e
, f
, h
;
85 #pragma omp threadprivate(g)
86 #if defined(OMP51) || defined(OMP52)
87 #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d, e,f) order(reproducible:concurrent)
89 #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d, e,f) order(concurrent)
91 // OMP50: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d,e,f) order(concurrent)
92 // OMP51: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d,e,f) order(reproducible: concurrent)
93 // OMP52: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d,e,f) order(reproducible: concurrent)
94 for (int i
= 0; i
< 2; ++i
)
96 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
98 #pragma omp parallel for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h)
99 for (int i
= 0; i
< 2; ++i
)
100 for (int j
= 0; j
< 2; ++j
)
101 for (int j
= 0; j
< 2; ++j
)
102 for (int j
= 0; j
< 2; ++j
)
103 for (int j
= 0; j
< 2; ++j
)
104 for (int i
= 0; i
< 2; ++i
)
105 for (int j
= 0; j
< 2; ++j
)
106 for (int j
= 0; j
< 2; ++j
)
107 for (int j
= 0; j
< 2; ++j
)
108 for (int j
= 0; j
< 2; ++j
)
110 // CHECK-NEXT: #pragma omp parallel for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h)
111 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
112 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
113 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
114 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
115 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
116 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
117 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
118 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
119 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
120 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
121 // CHECK-NEXT: foo();
127 for (int i
= 5 ; i
!= 0; ++i
)
129 // CHECK: int increment() {
130 // CHECK-NEXT: #pragma omp for
131 // CHECK-NEXT: for (int i = 5; i != 0; ++i)
136 int decrement_nowait () {
137 #pragma omp for nowait
138 for (int j
= 5 ; j
!= 0; --j
)
140 // CHECK: int decrement_nowait() {
141 // CHECK-NEXT: #pragma omp for nowait
142 // CHECK-NEXT: for (int j = 5; j != 0; --j)
148 int main(int argc
, char **argv
) {
149 int b
= argc
, c
, d
, e
, f
, h
;
151 // CHECK: static int a;
153 #pragma omp threadprivate(g)
154 #pragma omp parallel for schedule(guided, argc) default(none) copyin(g) linear(a) shared(argc) reduction(task,&:d)
155 // CHECK: #pragma omp parallel for schedule(guided, argc) default(none) copyin(g) linear(a) shared(argc) reduction(task, &: d)
156 for (int i
= 0; i
< 2; ++i
)
158 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
159 // CHECK-NEXT: a = 2;
161 #pragma omp parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) linear(a: step(-5))
163 #pragma omp parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) linear(a:-5)
165 for (int i
= 0; i
< 10; ++i
)
166 for (int j
= 0; j
< 10; ++j
)
168 // CHECK-NEXT: #pragma omp parallel for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) schedule(auto) ordered if(argc) num_threads(a) default(shared) shared(e) reduction(+: h) linear(a: step(-5))
169 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
170 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
171 // CHECK-NEXT: foo();
172 return (tmain
<int, 5>(argc
) + tmain
<char, 1>(argv
[0][0]));