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
|
2014-07-11 19:25:16 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
void foo() {}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
struct S {
|
|
|
|
operator T() { return T(); }
|
|
|
|
static T TS;
|
|
|
|
#pragma omp threadprivate(TS)
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: template <class T = int> struct S {
|
|
|
|
// CHECK: static int TS;
|
|
|
|
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK: template <class T = long> struct S {
|
|
|
|
// CHECK: static long TS;
|
|
|
|
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK: template <class T> struct S {
|
|
|
|
// CHECK: static T TS;
|
|
|
|
// CHECK-NEXT: #pragma omp threadprivate(S::TS)
|
|
|
|
// CHECK: };
|
|
|
|
|
|
|
|
template <typename T, int C>
|
|
|
|
T tmain(T argc, T *argv) {
|
|
|
|
T b = argc, c, d, e, f, g;
|
|
|
|
static T a;
|
|
|
|
S<T> s;
|
2015-06-23 22:25:19 +08:00
|
|
|
#pragma omp task untied depend(in : argc)
|
2014-07-11 19:25:16 +08:00
|
|
|
a = 2;
|
2014-07-17 15:32:53 +08:00
|
|
|
#pragma omp task default(none), private(argc, b) firstprivate(argv) shared(d) if (argc > 0) final(S<T>::TS > 0)
|
2014-07-11 19:25:16 +08:00
|
|
|
foo();
|
2014-07-17 20:47:03 +08:00
|
|
|
#pragma omp task if (C) mergeable
|
2014-07-11 19:25:16 +08:00
|
|
|
foo();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
|
|
|
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
|
|
|
// CHECK-NEXT: static int a;
|
|
|
|
// CHECK-NEXT: S<int> s;
|
2015-06-23 22:25:19 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task untied depend(in : argc)
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: a = 2;
|
2014-07-17 15:32:53 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<int>::TS > 0)
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: foo()
|
2014-07-17 20:47:03 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task if(5) mergeable
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: foo()
|
|
|
|
// CHECK: template <typename T = long, int C = 1> long tmain(long argc, long *argv) {
|
|
|
|
// CHECK-NEXT: long b = argc, c, d, e, f, g;
|
|
|
|
// CHECK-NEXT: static long a;
|
|
|
|
// CHECK-NEXT: S<long> s;
|
2015-06-23 22:25:19 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task untied depend(in : argc)
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: a = 2;
|
2014-07-17 15:32:53 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<long>::TS > 0)
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: foo()
|
2014-07-17 20:47:03 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task if(1) mergeable
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: foo()
|
|
|
|
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
|
|
|
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
|
|
|
// CHECK-NEXT: static T a;
|
|
|
|
// CHECK-NEXT: S<T> s;
|
2015-06-23 22:25:19 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task untied depend(in : argc)
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: a = 2;
|
2014-07-17 15:32:53 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<T>::TS > 0)
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: foo()
|
2014-07-17 20:47:03 +08:00
|
|
|
// CHECK-NEXT: #pragma omp task if(C) mergeable
|
2014-07-11 19:25:16 +08:00
|
|
|
// CHECK-NEXT: foo()
|
|
|
|
|
|
|
|
enum Enum {};
|
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
long x;
|
|
|
|
int b = argc, c, d, e, f, g;
|
|
|
|
static int a;
|
|
|
|
#pragma omp threadprivate(a)
|
|
|
|
Enum ee;
|
|
|
|
// CHECK: Enum ee;
|
2015-06-23 22:25:19 +08:00
|
|
|
#pragma omp task untied mergeable depend(out:argv[1])
|
|
|
|
// CHECK-NEXT: #pragma omp task untied mergeable depend(out : argv[1])
|
2014-07-11 19:25:16 +08:00
|
|
|
a = 2;
|
|
|
|
// CHECK-NEXT: a = 2;
|
2015-06-23 22:25:19 +08:00
|
|
|
#pragma omp task default(none), private(argc, b) firstprivate(argv) if (argc > 0) final(a > 0) depend(inout : a)
|
|
|
|
// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) if(argc > 0) final(a > 0) depend(inout : a)
|
2014-07-11 19:25:16 +08:00
|
|
|
foo();
|
|
|
|
// CHECK-NEXT: foo();
|
|
|
|
return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|