diff options
author | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-12-19 15:59:47 +0000 |
---|---|---|
committer | Joel E. Denny <jdenny.ornl@gmail.com> | 2018-12-19 15:59:47 +0000 |
commit | 0fdf5a9acccef8b5cf21a38bd5fd0496a285fbed (patch) | |
tree | 32946ee4c06058f4b71fcd1bcdaced0ad2ec6556 | |
parent | 6c735b02f15e70718d96d70c90ff3ba410e05950 (diff) | |
download | bcm5719-llvm-0fdf5a9acccef8b5cf21a38bd5fd0496a285fbed.tar.gz bcm5719-llvm-0fdf5a9acccef8b5cf21a38bd5fd0496a285fbed.zip |
[OpenMP] Fix data sharing analysis in nested clause
Without this patch, clang doesn't complain that X needs explicit data
sharing attributes in the following:
```
#pragma omp target teams default(none)
{
#pragma omp parallel num_threads(X)
;
}
```
However, clang does produce that complaint after the braces are
removed. With this patch, clang complains in both cases.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D55861
llvm-svn: 349635
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 10 | ||||
-rw-r--r-- | clang/test/OpenMP/target_teams_messages.cpp | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 38a329a1fdf..c207ba9bd32 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -2390,13 +2390,9 @@ public: void VisitStmt(Stmt *S) { for (Stmt *C : S->children()) { if (C) { - if (auto *OED = dyn_cast<OMPExecutableDirective>(C)) { - // Check implicitly captured variables in the task-based directives to - // check if they must be firstprivatized. - VisitSubCaptures(OED); - } else { - Visit(C); - } + // Check implicitly captured variables in the task-based directives to + // check if they must be firstprivatized. + Visit(C); } } } diff --git a/clang/test/OpenMP/target_teams_messages.cpp b/clang/test/OpenMP/target_teams_messages.cpp index 3a367bfc7e4..bc068f87b61 100644 --- a/clang/test/OpenMP/target_teams_messages.cpp +++ b/clang/test/OpenMP/target_teams_messages.cpp @@ -50,6 +50,16 @@ int main(int argc, char **argv) { #pragma omp target teams default(none) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} +#pragma omp target teams default(none) +#pragma omp parallel num_threads(argc) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} + ; + +#pragma omp target teams default(none) + { +#pragma omp parallel num_threads(argc) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} + ; + } + goto L2; // expected-error {{use of undeclared label 'L2'}} #pragma omp target teams L2: |