diff options
Diffstat (limited to 'flang/lib/Semantics/check-omp-loop.cpp')
-rw-r--r-- | flang/lib/Semantics/check-omp-loop.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/flang/lib/Semantics/check-omp-loop.cpp b/flang/lib/Semantics/check-omp-loop.cpp index c9d0495..aaaa2d6 100644 --- a/flang/lib/Semantics/check-omp-loop.cpp +++ b/flang/lib/Semantics/check-omp-loop.cpp @@ -127,24 +127,23 @@ using namespace Fortran::semantics::omp; void OmpStructureChecker::HasInvalidDistributeNesting( const parser::OpenMPLoopConstruct &x) { - bool violation{false}; const parser::OmpDirectiveName &beginName{x.BeginDir().DirName()}; if (llvm::omp::topDistributeSet.test(beginName.v)) { // `distribute` region has to be nested - if (!CurrentDirectiveIsNested()) { - violation = true; - } else { + if (CurrentDirectiveIsNested()) { // `distribute` region has to be strictly nested inside `teams` if (!llvm::omp::bottomTeamsSet.test(GetContextParent().directive)) { - violation = true; + context_.Say(beginName.source, + "`DISTRIBUTE` region has to be strictly nested inside `TEAMS` " + "region."_err_en_US); } + } else { + // If not lexically nested (orphaned), issue a warning. + context_.Say(beginName.source, + "`DISTRIBUTE` must be dynamically enclosed in a `TEAMS` " + "region."_warn_en_US); } } - if (violation) { - context_.Say(beginName.source, - "`DISTRIBUTE` region has to be strictly nested inside `TEAMS` " - "region."_err_en_US); - } } void OmpStructureChecker::HasInvalidLoopBinding( const parser::OpenMPLoopConstruct &x) { @@ -486,8 +485,8 @@ void OmpStructureChecker::Leave(const parser::OpenMPLoopConstruct &x) { common::visit( common::visitors{ [&](const parser::Designator &designator) { - if (const auto *name{semantics::getDesignatorNameIfDataRef( - designator)}) { + if (const auto *name{ + parser::GetDesignatorNameIfDataRef(designator)}) { checkReductionSymbolInScan(name); } }, |