@@ -554,18 +554,16 @@ void OmpStructureChecker::CheckHintClause(
554554 D *leftOmpClauseList, D *rightOmpClauseList) {
555555 auto checkForValidHintClause = [&](const D *clauseList) {
556556 for (const auto &clause : clauseList->v ) {
557- const Fortran::parser::OmpClause *ompClause = nullptr ;
558- if constexpr (std::is_same_v<D,
559- const Fortran::parser::OmpAtomicClauseList>) {
560- ompClause = std::get_if<Fortran::parser::OmpClause>(&clause.u );
557+ const parser::OmpClause *ompClause = nullptr ;
558+ if constexpr (std::is_same_v<D, const parser::OmpAtomicClauseList>) {
559+ ompClause = std::get_if<parser::OmpClause>(&clause.u );
561560 if (!ompClause)
562561 continue ;
563- } else if constexpr (std::is_same_v<D,
564- const Fortran::parser::OmpClauseList>) {
562+ } else if constexpr (std::is_same_v<D, const parser::OmpClauseList>) {
565563 ompClause = &clause;
566564 }
567- if (const Fortran:: parser::OmpClause::Hint *hintClause{
568- std::get_if<Fortran:: parser::OmpClause::Hint>(&ompClause->u )}) {
565+ if (const parser::OmpClause::Hint *hintClause{
566+ std::get_if<parser::OmpClause::Hint>(&ompClause->u )}) {
569567 std::optional<std::int64_t > hintValue = GetIntValue (hintClause->v );
570568 if (hintValue && *hintValue >= 0 ) {
571569 /* `omp_sync_hint_nonspeculative` and `omp_lock_hint_speculative`*/
@@ -793,7 +791,7 @@ void OmpStructureChecker::CheckSIMDNest(const parser::OpenMPConstruct &c) {
793791 // TODO: Check for declare simd regions.
794792 bool eligibleSIMD{false };
795793 common::visit (
796- Fortran:: common::visitors{
794+ common::visitors{
797795 // Allow `!$OMP ORDERED SIMD`
798796 [&](const parser::OpenMPBlockConstruct &c) {
799797 const auto &beginBlockDir{
@@ -2121,7 +2119,7 @@ void OmpStructureChecker::CheckCancellationNest(
21212119 eligibleCancellation = true ;
21222120 }
21232121 break ;
2124- case Fortran:: parser::OmpCancelType::Type::Do:
2122+ case parser::OmpCancelType::Type::Do:
21252123 if (llvm::omp::nestedCancelDoAllowedSet.test (
21262124 GetContextParent ().directive )) {
21272125 eligibleCancellation = true ;
@@ -2162,7 +2160,7 @@ void OmpStructureChecker::CheckCancellationNest(
21622160 parser::ToUpperCaseLetters (
21632161 parser::OmpCancelType::EnumToString (type)));
21642162 break ;
2165- case Fortran:: parser::OmpCancelType::Type::Do:
2163+ case parser::OmpCancelType::Type::Do:
21662164 context_.Say (source,
21672165 " %s %s directive is not closely nested inside "
21682166 " the construct that matches the DO clause type" _err_en_US,
@@ -2228,9 +2226,9 @@ inline void OmpStructureChecker::ErrIfAllocatableVariable(
22282226 const auto &designator =
22292227 std::get<common::Indirection<parser::Designator>>(var.u );
22302228 const auto *dataRef =
2231- std::get_if<Fortran:: parser::DataRef>(&designator.value ().u );
2232- const Fortran:: parser::Name *name =
2233- dataRef ? std::get_if<Fortran:: parser::Name>(&dataRef->u ) : nullptr ;
2229+ std::get_if<parser::DataRef>(&designator.value ().u );
2230+ const parser::Name *name =
2231+ dataRef ? std::get_if<parser::Name>(&dataRef->u ) : nullptr ;
22342232 if (name)
22352233 context_.Say (name->source ,
22362234 " %s must not have ALLOCATABLE "
@@ -2250,10 +2248,8 @@ inline void OmpStructureChecker::ErrIfLHSAndRHSSymbolsMatch(
22502248 const Symbol &varSymbol = vSyms.front ();
22512249 for (const Symbol &symbol : evaluate::GetSymbolVector (*e)) {
22522250 if (varSymbol == symbol) {
2253- const Fortran::common::Indirection<Fortran::parser::Designator>
2254- *designator = std::get_if<
2255- Fortran::common::Indirection<Fortran::parser::Designator>>(
2256- &expr.u );
2251+ const common::Indirection<parser::Designator> *designator =
2252+ std::get_if<common::Indirection<parser::Designator>>(&expr.u );
22572253 if (designator) {
22582254 auto *z{var.typedExpr .get ()};
22592255 auto *c{expr.typedExpr .get ()};
@@ -2334,10 +2330,9 @@ void OmpStructureChecker::CheckAtomicCaptureStmt(
23342330 common::visitors{
23352331 [&](const common::Indirection<parser::Designator> &designator) {
23362332 const auto *dataRef =
2337- std::get_if<Fortran::parser::DataRef>(&designator.value ().u );
2338- const auto *name = dataRef
2339- ? std::get_if<Fortran::parser::Name>(&dataRef->u )
2340- : nullptr ;
2333+ std::get_if<parser::DataRef>(&designator.value ().u );
2334+ const auto *name =
2335+ dataRef ? std::get_if<parser::Name>(&dataRef->u ) : nullptr ;
23412336 if (name && IsAllocatable (*name->symbol ))
23422337 context_.Say (name->source ,
23432338 " %s must not have ALLOCATABLE "
@@ -2470,23 +2465,21 @@ void OmpStructureChecker::CheckAtomicCompareConstruct(
24702465// TODO: Allow cond-update-stmt once compare clause is supported.
24712466void OmpStructureChecker::CheckAtomicCaptureConstruct (
24722467 const parser::OmpAtomicCapture &atomicCaptureConstruct) {
2473- const Fortran::parser::AssignmentStmt &stmt1 =
2474- std::get<Fortran::parser::OmpAtomicCapture::Stmt1>(
2475- atomicCaptureConstruct.t )
2468+ const parser::AssignmentStmt &stmt1 =
2469+ std::get<parser::OmpAtomicCapture::Stmt1>(atomicCaptureConstruct.t )
24762470 .v .statement ;
2477- const auto &stmt1Var{std::get<Fortran:: parser::Variable>(stmt1.t )};
2478- const auto &stmt1Expr{std::get<Fortran:: parser::Expr>(stmt1.t )};
2471+ const auto &stmt1Var{std::get<parser::Variable>(stmt1.t )};
2472+ const auto &stmt1Expr{std::get<parser::Expr>(stmt1.t )};
24792473
2480- const Fortran::parser::AssignmentStmt &stmt2 =
2481- std::get<Fortran::parser::OmpAtomicCapture::Stmt2>(
2482- atomicCaptureConstruct.t )
2474+ const parser::AssignmentStmt &stmt2 =
2475+ std::get<parser::OmpAtomicCapture::Stmt2>(atomicCaptureConstruct.t )
24832476 .v .statement ;
2484- const auto &stmt2Var{std::get<Fortran:: parser::Variable>(stmt2.t )};
2485- const auto &stmt2Expr{std::get<Fortran:: parser::Expr>(stmt2.t )};
2477+ const auto &stmt2Var{std::get<parser::Variable>(stmt2.t )};
2478+ const auto &stmt2Expr{std::get<parser::Expr>(stmt2.t )};
24862479
2487- if (Fortran:: semantics::checkForSingleVariableOnRHS (stmt1)) {
2480+ if (semantics::checkForSingleVariableOnRHS (stmt1)) {
24882481 CheckAtomicCaptureStmt (stmt1);
2489- if (Fortran:: semantics::checkForSymbolMatch (stmt2)) {
2482+ if (semantics::checkForSymbolMatch (stmt2)) {
24902483 // ATOMIC CAPTURE construct is of the form [capture-stmt, update-stmt]
24912484 CheckAtomicUpdateStmt (stmt2);
24922485 } else {
@@ -2500,8 +2493,8 @@ void OmpStructureChecker::CheckAtomicCaptureConstruct(
25002493 " Captured variable/array element/derived-type component %s expected to be assigned in the second statement of ATOMIC CAPTURE construct" _err_en_US,
25012494 stmt1Expr.source );
25022495 }
2503- } else if (Fortran:: semantics::checkForSymbolMatch (stmt1) &&
2504- Fortran:: semantics::checkForSingleVariableOnRHS (stmt2)) {
2496+ } else if (semantics::checkForSymbolMatch (stmt1) &&
2497+ semantics::checkForSingleVariableOnRHS (stmt2)) {
25052498 // ATOMIC CAPTURE construct is of the form [update-stmt, capture-stmt]
25062499 CheckAtomicUpdateStmt (stmt1);
25072500 CheckAtomicCaptureStmt (stmt2);
@@ -2524,28 +2517,28 @@ void OmpStructureChecker::CheckAtomicMemoryOrderClause(
25242517 const parser::OmpAtomicClauseList *rightHandClauseList) {
25252518 int numMemoryOrderClause{0 };
25262519 int numFailClause{0 };
2527- auto checkForValidMemoryOrderClause =
2528- [&](const parser::OmpAtomicClauseList *clauseList) {
2529- for (const auto &clause : clauseList->v ) {
2530- if (std::get_if<parser::OmpFailClause>(&clause.u )) {
2531- numFailClause++;
2532- if (numFailClause > 1 ) {
2533- context_.Say (clause.source ,
2534- " More than one FAIL clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2535- return ;
2536- }
2537- } else {
2538- if (std::get_if<Fortran::parser::OmpMemoryOrderClause>(&clause.u )) {
2539- numMemoryOrderClause++;
2540- if (numMemoryOrderClause > 1 ) {
2541- context_.Say (clause.source ,
2542- " More than one memory order clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2543- return ;
2544- }
2545- }
2520+ auto checkForValidMemoryOrderClause = [&](const parser::OmpAtomicClauseList
2521+ *clauseList) {
2522+ for (const auto &clause : clauseList->v ) {
2523+ if (std::get_if<parser::OmpFailClause>(&clause.u )) {
2524+ numFailClause++;
2525+ if (numFailClause > 1 ) {
2526+ context_.Say (clause.source ,
2527+ " More than one FAIL clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2528+ return ;
2529+ }
2530+ } else {
2531+ if (std::get_if<parser::OmpMemoryOrderClause>(&clause.u )) {
2532+ numMemoryOrderClause++;
2533+ if (numMemoryOrderClause > 1 ) {
2534+ context_.Say (clause.source ,
2535+ " More than one memory order clause not allowed on OpenMP ATOMIC construct" _err_en_US);
2536+ return ;
25462537 }
25472538 }
2548- };
2539+ }
2540+ }
2541+ };
25492542 if (leftHandClauseList) {
25502543 checkForValidMemoryOrderClause (leftHandClauseList);
25512544 }
0 commit comments