[clang] a8eccca - [OpenMP][FIX] Allow multiple `depend` clauses on a `taskwait nowait`
Johannes Doerfert via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 11 22:38:18 PST 2023
Author: Johannes Doerfert
Date: 2023-01-11T22:24:23-08:00
New Revision: a8eccca934156943f02c4423e4b7df12fe77dca8
URL: https://github.com/llvm/llvm-project/commit/a8eccca934156943f02c4423e4b7df12fe77dca8
DIFF: https://github.com/llvm/llvm-project/commit/a8eccca934156943f02c4423e4b7df12fe77dca8.diff
LOG: [OpenMP][FIX] Allow multiple `depend` clauses on a `taskwait nowait`
Fixes https://github.com/llvm/llvm-project/issues/59941
Differential Revision: https://reviews.llvm.org/D141531
Added:
Modified:
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/taskwait_ast_print.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index e6035578a9cde..f48707d73b734 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -11109,9 +11109,10 @@ StmtResult Sema::ActOnOpenMPTaskwaitDirective(ArrayRef<OMPClause *> Clauses,
SourceLocation EndLoc) {
const OMPNowaitClause *NowaitC =
OMPExecutableDirective::getSingleClause<OMPNowaitClause>(Clauses);
- const OMPDependClause *DependC =
- OMPExecutableDirective::getSingleClause<OMPDependClause>(Clauses);
- if (NowaitC && !DependC) {
+ bool HasDependC =
+ !OMPExecutableDirective::getClausesOfKind<OMPDependClause>(Clauses)
+ .empty();
+ if (NowaitC && !HasDependC) {
Diag(StartLoc, diag::err_omp_nowait_clause_without_depend);
return StmtError();
}
diff --git a/clang/test/OpenMP/taskwait_ast_print.cpp b/clang/test/OpenMP/taskwait_ast_print.cpp
index 670e1fbe7fc76..10823c6cd782c 100644
--- a/clang/test/OpenMP/taskwait_ast_print.cpp
+++ b/clang/test/OpenMP/taskwait_ast_print.cpp
@@ -25,6 +25,7 @@ T ndmain(T argc) {
static T a;
#pragma omp taskwait
#pragma omp taskwait depend(in:a, argc) nowait
+#pragma omp taskwait depend(in:a) depend(in:argc) nowait
return a + argc;
}
@@ -41,12 +42,15 @@ T ndmain(T argc) {
// CHECK: static T a;
// CHECK-NEXT: #pragma omp taskwait{{$}}
// CHECK-NEXT: #pragma omp taskwait depend(in : a,argc) nowait{{$}}
+// CHECK-NEXT: #pragma omp taskwait depend(in : a) depend(in : argc) nowait{{$}}
// CHECK: static int a;
// CHECK-NEXT: #pragma omp taskwait
// CHECK-NEXT: #pragma omp taskwait depend(in : a,argc) nowait{{$}}
+// CHECK-NEXT: #pragma omp taskwait depend(in : a) depend(in : argc) nowait{{$}}
// CHECK: static char a;
// CHECK-NEXT: #pragma omp taskwait
// CHECK-NEXT: #pragma omp taskwait depend(in : a,argc) nowait{{$}}
+// CHECK-NEXT: #pragma omp taskwait depend(in : a) depend(in : argc) nowait{{$}}
int main(int argc, char **argv) {
static int a;
More information about the cfe-commits
mailing list