diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-21 03:16:40 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-21 03:16:40 +0000 |
commit | 03b340a3a5608eecf447bdbcb0a3b64714e4efd7 (patch) | |
tree | 230ba545e88bcc01901ab44644ff0e79dd2d450b /clang/test/OpenMP/task_private_messages.cpp | |
parent | 322d0df309b5a01612e3a2dbc194e300d2cd5176 (diff) | |
download | bcm5719-llvm-03b340a3a5608eecf447bdbcb0a3b64714e4efd7.tar.gz bcm5719-llvm-03b340a3a5608eecf447bdbcb0a3b64714e4efd7.zip |
[OPENMP] Codegen for 'private' clause in 'parallel' directive.
This patch generates some helper variables which used as a private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by default (with the default constructor, if any). In outlined function references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables and implicit barier is set by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D4752
llvm-svn: 220262
Diffstat (limited to 'clang/test/OpenMP/task_private_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/task_private_messages.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/test/OpenMP/task_private_messages.cpp b/clang/test/OpenMP/task_private_messages.cpp index 0be238dd90c..9a3bb757681 100644 --- a/clang/test/OpenMP/task_private_messages.cpp +++ b/clang/test/OpenMP/task_private_messages.cpp @@ -27,16 +27,16 @@ public: const S3 c; // expected-note {{global variable is predetermined as shared}} const S3 ca[5]; // expected-note {{global variable is predetermined as shared}} extern const int f; // expected-note {{global variable is predetermined as shared}} -class S4 { // expected-note {{'S4' declared here}} +class S4 { int a; - S4(); + S4(); // expected-note {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note {{'S5' declared here}} +class S5 { int a; - S5() : a(0) {} + S5() : a(0) {} // expected-note {{implicitly declared private here}} public: S5(int v) : a(v) {} @@ -48,8 +48,8 @@ int threadvar; int main(int argc, char **argv) { const int d = 5; // expected-note {{constant variable is predetermined as shared}} const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}} - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note {{'g' defined here}} + S4 e(4); + S5 g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp task private // expected-error {{expected '(' after 'private'}} @@ -66,7 +66,7 @@ int main(int argc, char **argv) { #pragma omp task private(ca) // expected-error {{shared variable cannot be private}} #pragma omp task private(da) // expected-error {{shared variable cannot be private}} #pragma omp task private(S2::S2s) // expected-error {{shared variable cannot be private}} -#pragma omp task private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}} +#pragma omp task private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} #pragma omp task private(threadvar) // expected-error {{threadprivate or thread local variable cannot be private}} #pragma omp task shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}} foo(); |