@@ -990,9 +990,9 @@ void OmpStructureChecker::Leave(const parser::OpenMPLoopConstruct &x) {
990990 const auto &objectList{
991991 std::get<parser::OmpObjectList>(reductionClause->v .t )};
992992 auto checkReductionSymbolInScan = [&](const parser::Name *name) {
993- if (name->symbol ) {
994- if (!scanReductionInfoStack. top (). findSymbolInScanConstruct (
995- name-> symbol )) {
993+ if (auto &symbol = name->symbol ) {
994+ if (!symbol-> test (Symbol::Flag::OmpInclusiveScan) &&
995+ !symbol-> test (Symbol::Flag::OmpExclusiveScan )) {
996996 context_.Say (name->source ,
997997 " List item %s must appear in EXCLUSIVE or "
998998 " INCLUSIVE clause of an "
@@ -1014,7 +1014,6 @@ void OmpStructureChecker::Leave(const parser::OpenMPLoopConstruct &x) {
10141014 },
10151015 ompObj.u );
10161016 }
1017- scanReductionInfoStack.pop ();
10181017 }
10191018 }
10201019 }
@@ -2740,12 +2739,14 @@ CHECK_SIMPLE_CLAUSE(Depobj, OMPC_depobj)
27402739CHECK_SIMPLE_CLAUSE (Detach, OMPC_detach)
27412740CHECK_SIMPLE_CLAUSE (DeviceType, OMPC_device_type)
27422741CHECK_SIMPLE_CLAUSE (DistSchedule, OMPC_dist_schedule)
2742+ CHECK_SIMPLE_CLAUSE (Exclusive, OMPC_exclusive)
27432743CHECK_SIMPLE_CLAUSE (Final, OMPC_final)
27442744CHECK_SIMPLE_CLAUSE (Flush, OMPC_flush)
27452745CHECK_SIMPLE_CLAUSE (Full, OMPC_full)
27462746CHECK_SIMPLE_CLAUSE (Grainsize, OMPC_grainsize)
27472747CHECK_SIMPLE_CLAUSE (Hint, OMPC_hint)
27482748CHECK_SIMPLE_CLAUSE (Holds, OMPC_holds)
2749+ CHECK_SIMPLE_CLAUSE (Inclusive, OMPC_inclusive)
27492750CHECK_SIMPLE_CLAUSE (InReduction, OMPC_in_reduction)
27502751CHECK_SIMPLE_CLAUSE (Match, OMPC_match)
27512752CHECK_SIMPLE_CLAUSE (Nontemporal, OMPC_nontemporal)
@@ -2842,26 +2843,10 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Reduction &x) {
28422843 if (const auto &maybeModifier{
28432844 std::get<std::optional<ReductionModifier>>(x.v .t )}) {
28442845 const ReductionModifier modifier{*maybeModifier};
2845- if (modifier == ReductionModifier::Inscan) {
2846- scanReductionInfoStack.emplace ();
2847- const auto &ompObjectList{std::get<parser::OmpObjectList>(x.v .t )};
2848- scanReductionInfoStack.top ().mapSymbolsToReductionModifiers (
2849- ompObjectList, modifier);
2850- }
28512846 CheckReductionModifier (modifier);
28522847 }
28532848}
28542849
2855- void OmpStructureChecker::Enter (const parser::OmpClause::Inclusive &x) {
2856- CheckAllowed (llvm::omp::Clause::OMPC_inclusive);
2857- CheckAndMarkSymbolsUsedInScan (x.v );
2858- }
2859-
2860- void OmpStructureChecker::Enter (const parser::OmpClause::Exclusive &x) {
2861- CheckAllowed (llvm::omp::Clause::OMPC_exclusive);
2862- CheckAndMarkSymbolsUsedInScan (x.v );
2863- }
2864-
28652850bool OmpStructureChecker::CheckReductionOperators (
28662851 const parser::OmpClause::Reduction &x) {
28672852
@@ -2903,41 +2888,6 @@ bool OmpStructureChecker::CheckReductionOperators(
29032888 return ok;
29042889}
29052890
2906- void OmpStructureChecker::CheckAndMarkSymbolsUsedInScan (
2907- const parser::OmpObjectList &x) {
2908- for (const auto &ompObj : x.v ) {
2909- auto checkAndMark = [&](const parser::Name *name) {
2910- if (name->symbol ) {
2911- if (CurrentDirectiveIsNested ()) {
2912- ScanReductionInfo &scanReductionInfo = scanReductionInfoStack.top ();
2913- std::optional<ReductionModifier> reductionMod =
2914- scanReductionInfo.findReductionModifier (name->symbol );
2915- if (!reductionMod.has_value () ||
2916- reductionMod.value () != ReductionModifier::Inscan) {
2917- context_.Say (name->source ,
2918- " List item %s must appear in REDUCTION clause "
2919- " with the INSCAN modifier of the parent "
2920- " directive" _err_en_US,
2921- name->ToString ());
2922- }
2923- scanReductionInfo.markSymbolAsUsedInScanConstruct (name->symbol );
2924- }
2925- }
2926- };
2927- common::visit (
2928- common::visitors{
2929- [&](const parser::Designator &designator) {
2930- if (const auto *name{
2931- semantics::getDesignatorNameIfDataRef (designator)}) {
2932- checkAndMark (name);
2933- }
2934- },
2935- [&](const auto &name) { checkAndMark (&name); },
2936- },
2937- ompObj.u );
2938- }
2939- }
2940-
29412891bool OmpStructureChecker::CheckIntrinsicOperator (
29422892 const parser::DefinedOperator::IntrinsicOperator &op) {
29432893
0 commit comments