2015-05-20 12:24:19 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
2017-12-30 02:07:07 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
2014-06-26 20:05:45 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
void foo() {}
|
|
|
|
|
2016-03-17 18:50:17 +08:00
|
|
|
struct SS {
|
|
|
|
int a;
|
|
|
|
int b : 4;
|
|
|
|
int &c;
|
|
|
|
SS(int &d) : a(0), b(0), c(d) {
|
|
|
|
#pragma omp parallel firstprivate(a, b, c)
|
|
|
|
#pragma omp single copyprivate(a, this->b, (this)->c)
|
|
|
|
// CHECK: #pragma omp parallel firstprivate(this->a,this->b,this->c)
|
2018-02-15 01:38:47 +08:00
|
|
|
// CHECK-NEXT: #pragma omp single copyprivate(this->a,this->b,this->c){{$}}
|
2016-03-17 18:50:17 +08:00
|
|
|
++this->a, --b, (this)->c /= 1;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct SST {
|
|
|
|
T a;
|
|
|
|
SST() : a(T()) {
|
|
|
|
// CHECK: #pragma omp parallel firstprivate(this->a)
|
|
|
|
// CHECK-NEXT: #pragma omp single copyprivate(this->a)
|
|
|
|
// CHECK: #pragma omp parallel firstprivate(this->a)
|
|
|
|
// CHECK-NEXT: #pragma omp single copyprivate(this->a)
|
|
|
|
#pragma omp parallel firstprivate(a)
|
|
|
|
#pragma omp single copyprivate(this->a)
|
|
|
|
++this->a;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-06-26 20:05:45 +08:00
|
|
|
template <class T, int N>
|
|
|
|
T tmain(T argc) {
|
|
|
|
T b = argc, c, d, e, f, g;
|
|
|
|
static T a;
|
2016-03-17 18:50:17 +08:00
|
|
|
SST<T> sst;
|
2014-06-26 20:05:45 +08:00
|
|
|
// CHECK: static T a;
|
2014-06-27 18:37:06 +08:00
|
|
|
#pragma omp parallel private(g)
|
2019-03-27 22:14:31 +08:00
|
|
|
#pragma omp single private(argc, b), firstprivate(c, d), nowait allocate(d)
|
2014-06-26 20:05:45 +08:00
|
|
|
foo();
|
2016-03-17 18:50:17 +08:00
|
|
|
// CHECK: #pragma omp parallel private(g)
|
2019-03-27 22:14:31 +08:00
|
|
|
// CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) nowait allocate(d)
|
2015-01-19 13:20:46 +08:00
|
|
|
// CHECK-NEXT: foo();
|
|
|
|
#pragma omp parallel private(g)
|
2019-03-27 22:14:31 +08:00
|
|
|
#pragma omp single allocate(argc) private(argc, b), firstprivate(c, d), copyprivate(g)
|
2015-01-19 13:20:46 +08:00
|
|
|
foo();
|
|
|
|
// CHECK-NEXT: #pragma omp parallel private(g)
|
2019-03-27 22:14:31 +08:00
|
|
|
// CHECK-NEXT: #pragma omp single allocate(argc) private(argc,b) firstprivate(c,d) copyprivate(g)
|
2014-06-26 20:05:45 +08:00
|
|
|
// CHECK-NEXT: foo();
|
|
|
|
return T();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK: int main(int argc, char **argv) {
|
2014-06-26 20:05:45 +08:00
|
|
|
int b = argc, c, d, e, f, g;
|
|
|
|
static int a;
|
2016-03-17 18:50:17 +08:00
|
|
|
SS ss(a);
|
2014-06-26 20:05:45 +08:00
|
|
|
// CHECK: static int a;
|
2014-06-27 18:37:06 +08:00
|
|
|
#pragma omp parallel private(g)
|
2015-01-19 13:20:46 +08:00
|
|
|
#pragma omp single private(argc, b), firstprivate(argv, c), nowait
|
|
|
|
foo();
|
2016-03-17 18:50:17 +08:00
|
|
|
// CHECK: #pragma omp parallel private(g)
|
2015-01-19 13:20:46 +08:00
|
|
|
// CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(argv,c) nowait
|
|
|
|
// CHECK-NEXT: foo();
|
|
|
|
#pragma omp parallel private(g)
|
|
|
|
#pragma omp single private(argc, b), firstprivate(c, d), copyprivate(g)
|
2014-06-26 20:05:45 +08:00
|
|
|
foo();
|
2014-06-27 18:37:06 +08:00
|
|
|
// CHECK-NEXT: #pragma omp parallel private(g)
|
2015-01-19 13:20:46 +08:00
|
|
|
// CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) copyprivate(g)
|
2014-06-26 20:05:45 +08:00
|
|
|
// CHECK-NEXT: foo();
|
|
|
|
return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|