[PATCH] D55861: [OpenMP] Fix data sharing analysis in nested clause
Joel E. Denny via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 18 15:42:08 PST 2018
jdenny created this revision.
jdenny added a reviewer: ABataev.
Herald added a subscriber: guansong.
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.
Repository:
rC Clang
https://reviews.llvm.org/D55861
Files:
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/target_teams_messages.cpp
Index: clang/test/OpenMP/target_teams_messages.cpp
===================================================================
--- clang/test/OpenMP/target_teams_messages.cpp
+++ clang/test/OpenMP/target_teams_messages.cpp
@@ -50,6 +50,16 @@
#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:
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -2390,13 +2390,9 @@
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);
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55861.178803.patch
Type: text/x-patch
Size: 1580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181218/046b4945/attachment.bin>
More information about the cfe-commits
mailing list