Skip to content

Commit 9b8dbd9

Browse files
committed
R4: Addressing review comments
1 parent a0480ca commit 9b8dbd9

File tree

5 files changed

+9
-44
lines changed

5 files changed

+9
-44
lines changed

flang/include/flang/Semantics/openmp-directive-sets.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,17 @@ static const OmpDirectiveSet allTeamsSet{
187187
// Directive sets for groups of multiple directives
188188
//===----------------------------------------------------------------------===//
189189

190-
// Composite constructs
190+
// Directive sets for parent directives that do allow/not allow a construct
191+
static const OmpDirectiveSet scanAllowedSet{allDoSet | allSimdSet};
192+
193+
// Directive sets that form Composite constructs
191194
static const OmpDirectiveSet allDistributeParallelDoSet{
192195
allDistributeSet & allParallelSet & allDoSet};
193196
static const OmpDirectiveSet allDistributeParallelDoSimdSet{
194197
allDistributeSet & allParallelSet & allDoSet & allSimdSet};
195198
static const OmpDirectiveSet allDistributeSimdSet{
196199
allDistributeSet & allSimdSet};
197200
static const OmpDirectiveSet allDoSimdSet{allDoSet & allSimdSet};
198-
static const OmpDirectiveSet scanAllowedSet{allDoSet | allSimdSet};
199201
static const OmpDirectiveSet allTaskloopSimdSet{allTaskloopSet & allSimdSet};
200202

201203
static const OmpDirectiveSet compositeConstructSet{

flang/lib/Semantics/resolve-directives.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,12 +1639,12 @@ bool OmpAttributeVisitor::Pre(
16391639
break;
16401640
}
16411641
if (standaloneDir.v == llvm::omp::Directive::OMPD_scan) {
1642-
if ((std::get<parser::OmpClauseList>(x.t).v.size() != 1)) {
1642+
if (std::get<parser::OmpClauseList>(x.t).v.size() != 1) {
16431643
context_.Say(standaloneDir.source,
16441644
"Exactly one of `exclusive` or `inclusive` clause is expected"_err_en_US);
16451645
}
16461646
if (!parentContext ||
1647-
(!llvm::omp::scanAllowedSet.test(parentContext->directive))) {
1647+
!llvm::omp::scanAllowedSet.test(parentContext->directive)) {
16481648
context_.Say(standaloneDir.source,
16491649
"Orphaned `omp scan` directives are prohibited; perhaps you forgot "
16501650
"to enclose the directive in to a worksharing loop, a worksharing "

flang/test/Parser/OpenMP/scan.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ subroutine test_scan(n, a, b)
3232
x = x + a(k)
3333
end do
3434

35-
!$omp parallel do simd reduction(inscan,+: x)
35+
!$omp parallel do simd reduction(inscan,+: x, y)
3636
do k = 1, n
3737
x = x + a(k)
3838
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct
@@ -44,7 +44,7 @@ subroutine test_scan(n, a, b)
4444
b(k) = x
4545
end do
4646

47-
!$omp parallel do simd reduction(inscan,+: x)
47+
!$omp parallel do simd reduction(inscan,+: x, y)
4848
do k = 1, n
4949
x = x + a(k)
5050
!PARSE-TREE: ExecutionPartConstruct -> ExecutableConstruct -> OpenMPConstruct -> OpenMPStandaloneConstruct -> OpenMPSimpleStandaloneConstruct

flang/test/Semantics/OpenMP/out

Lines changed: 0 additions & 37 deletions
This file was deleted.

flang/test/Semantics/OpenMP/scan.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ subroutine test_scan()
1717
!$omp scan
1818
end do
1919

20-
!$omp parallel do simd reduction(inscan,+: x)
20+
!$omp parallel do simd reduction(inscan,+: x, y)
2121
do k = 1, n
2222
!ERROR: Exactly one of `exclusive` or `inclusive` clause is expected
2323
!$omp scan inclusive(x) exclusive(y)

0 commit comments

Comments
 (0)