Skip to content

[Flang][OpenMP][Sema] Adding parsing and semantic support for scan directive. #102792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Nov 15, 2024
Prev Previous commit
Next Next commit
R5: Addressing a few more review comments
  • Loading branch information
anchuraj committed Nov 13, 2024
commit 865ca2ec7c4cb06d6537d71bffb347d5e2e7d30e
8 changes: 5 additions & 3 deletions flang/include/flang/Semantics/openmp-directive-sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,6 @@ static const OmpDirectiveSet allTeamsSet{
// Directive sets for groups of multiple directives
//===----------------------------------------------------------------------===//

// Directive sets for parent directives that do allow/not allow a construct
static const OmpDirectiveSet scanAllowedSet{allDoSet | allSimdSet};

// Directive sets that form Composite constructs
static const OmpDirectiveSet allDistributeParallelDoSet{
allDistributeSet & allParallelSet & allDoSet};
Expand Down Expand Up @@ -293,6 +290,11 @@ static const OmpDirectiveSet workShareSet{
} | allDoSet,
};

//===----------------------------------------------------------------------===//
// Directive sets for parent directives that do allow/not allow a construct
static const OmpDirectiveSet scanParentAllowedSet{allDoSet | allSimdSet};
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
// Directive sets for allowed/not allowed nested directives
//===----------------------------------------------------------------------===//
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/check-omp-structure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2990,7 +2990,7 @@ void OmpStructureChecker::CheckReductionModifier(
// or "simd" directive.
// The worksharing-loop directives are OMPD_do and OMPD_for. Only the
// former is allowed in Fortran.
if (!llvm::omp::scanAllowedSet.test(dirCtx.directive)) {
if (!llvm::omp::scanParentAllowedSet.test(dirCtx.directive)) {
context_.Say(GetContext().clauseSource,
"Modifier 'INSCAN' on REDUCTION clause is only allowed with "
"worksharing-loop, worksharing-loop simd, "
Expand Down
2 changes: 1 addition & 1 deletion flang/lib/Semantics/resolve-directives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ bool OmpAttributeVisitor::Pre(
"Exactly one of `exclusive` or `inclusive` clause is expected"_err_en_US);
}
if (!parentContext ||
!llvm::omp::scanAllowedSet.test(parentContext->directive)) {
!llvm::omp::scanParentAllowedSet.test(parentContext->directive)) {
context_.Say(standaloneDir.source,
"Orphaned `omp scan` directives are prohibited; perhaps you forgot "
"to enclose the directive in to a worksharing loop, a worksharing "
Expand Down