summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/for_simd_ast_print.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-01-20 09:07:54 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-01-20 09:07:54 +0000
commit48c0bfb99f12c1075a55bbe7722dd3f66eb3bab0 (patch)
treedc8d0717f555c338b931b8b0c688f6d87f9e67e0 /clang/test/OpenMP/for_simd_ast_print.cpp
parenteba303923857fbb102491eecc03f5f53d203419f (diff)
downloadbcm5719-llvm-48c0bfb99f12c1075a55bbe7722dd3f66eb3bab0.tar.gz
bcm5719-llvm-48c0bfb99f12c1075a55bbe7722dd3f66eb3bab0.zip
[OPENMP 4.5] Allow to use non-static data members in non-static member functions in 'private' clause.
OpenMP 4.5 allows to use non-static members of current class in non-static member functions in 'private' clause. Patch adds initial support for privatizing data members. llvm-svn: 258299
Diffstat (limited to 'clang/test/OpenMP/for_simd_ast_print.cpp')
-rw-r--r--clang/test/OpenMP/for_simd_ast_print.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/clang/test/OpenMP/for_simd_ast_print.cpp b/clang/test/OpenMP/for_simd_ast_print.cpp
index d4b13ba1998..54f0d467613 100644
--- a/clang/test/OpenMP/for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/for_simd_ast_print.cpp
@@ -6,6 +6,57 @@
#ifndef HEADER
#define HEADER
+struct S1 {
+ S1(): a(0) {}
+ S1(int v) : a(v) {}
+ int a;
+ typedef int type;
+};
+
+template <typename T>
+class S7 : public T {
+protected:
+ T a;
+ S7() : a(0) {}
+
+public:
+ S7(typename T::type v) : a(v) {
+#pragma omp for simd private(a) private(this->a) private(T::a)
+ for (int k = 0; k < a.a; ++k)
+ ++this->a.a;
+ }
+ S7 &operator=(S7 &s) {
+#pragma omp for simd private(a) private(this->a)
+ for (int k = 0; k < s.a.a; ++k)
+ ++s.a.a;
+ return *this;
+ }
+};
+
+// CHECK: #pragma omp for simd private(this->a) private(this->a) private(this->S1::a)
+// CHECK: #pragma omp for simd private(this->a) private(this->a) private(T::a)
+// CHECK: #pragma omp for simd private(this->a) private(this->a)
+
+class S8 : public S7<S1> {
+ S8() {}
+
+public:
+ S8(int v) : S7<S1>(v){
+#pragma omp for simd private(a) private(this->a) private(S7<S1>::a)
+ for (int k = 0; k < a.a; ++k)
+ ++this->a.a;
+ }
+ S8 &operator=(S8 &s) {
+#pragma omp for simd private(a) private(this->a)
+ for (int k = 0; k < s.a.a; ++k)
+ ++s.a.a;
+ return *this;
+ }
+};
+
+// CHECK: #pragma omp for simd private(this->a) private(this->a) private(this->S7<S1>::a)
+// CHECK: #pragma omp for simd private(this->a) private(this->a)
+
void foo() {}
int g_ind = 1;
template<class T, class N> T reduct(T* arr, N num) {
OpenPOWER on IntegriCloud