@@ -522,49 +522,47 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
522522 const auto &objList{std::get<parser::OmpObjectList>(x.v .t )};
523523 ResolveOmpObjectList (objList, Symbol::Flag::OmpReduction);
524524
525- auto &modifiers{OmpGetModifiers (x.v )};
526- if (!modifiers) {
527- return false ;
528- }
529-
530- auto createDummyProcSymbol = [&](const parser::Name *name) {
531- // If name resolution failed, create a dummy symbol
532- const auto namePair{
533- currScope ().try_emplace (name->source , Attrs{}, ProcEntityDetails{})};
534- auto &newSymbol{*namePair.first ->second };
535- if (context_.intrinsics ().IsIntrinsic (name->ToString ())) {
536- newSymbol.attrs ().set (Attr::INTRINSIC);
537- }
538- name->symbol = &newSymbol;
539- };
525+ if (auto &modifiers{OmpGetModifiers (x.v )}) {
526+ auto createDummyProcSymbol = [&](const parser::Name *name) {
527+ // If name resolution failed, create a dummy symbol
528+ const auto namePair{currScope ().try_emplace (
529+ name->source , Attrs{}, ProcEntityDetails{})};
530+ auto &newSymbol{*namePair.first ->second };
531+ if (context_.intrinsics ().IsIntrinsic (name->ToString ())) {
532+ newSymbol.attrs ().set (Attr::INTRINSIC);
533+ }
534+ name->symbol = &newSymbol;
535+ };
540536
541- for (auto &mod : *modifiers) {
542- if (!std::holds_alternative<parser::OmpReductionIdentifier>(mod.u )) {
543- continue ;
544- }
545- auto &opr{std::get<parser::OmpReductionIdentifier>(mod.u )};
546- if (auto *procD{parser::Unwrap<parser::ProcedureDesignator>(opr.u )}) {
547- if (auto *name{parser::Unwrap<parser::Name>(procD->u )}) {
548- if (!name->symbol ) {
549- if (!ResolveName (name)) {
550- createDummyProcSymbol (name);
537+ for (auto &mod : *modifiers) {
538+ if (!std::holds_alternative<parser::OmpReductionIdentifier>(mod.u )) {
539+ continue ;
540+ }
541+ auto &opr{std::get<parser::OmpReductionIdentifier>(mod.u )};
542+ if (auto *procD{parser::Unwrap<parser::ProcedureDesignator>(opr.u )}) {
543+ if (auto *name{parser::Unwrap<parser::Name>(procD->u )}) {
544+ if (!name->symbol ) {
545+ if (!ResolveName (name)) {
546+ createDummyProcSymbol (name);
547+ }
551548 }
552549 }
553- }
554- if (auto *procRef{parser::Unwrap<parser::ProcComponentRef>(procD->u )}) {
555- if (!procRef->v .thing .component .symbol ) {
556- if (!ResolveName (&procRef->v .thing .component )) {
557- createDummyProcSymbol (&procRef->v .thing .component );
550+ if (auto *procRef{
551+ parser::Unwrap<parser::ProcComponentRef>(procD->u )}) {
552+ if (!procRef->v .thing .component .symbol ) {
553+ if (!ResolveName (&procRef->v .thing .component )) {
554+ createDummyProcSymbol (&procRef->v .thing .component );
555+ }
558556 }
559557 }
560558 }
561559 }
562- }
563- using ReductionModifier = parser::OmpReductionModifier;
564- if ( auto *maybeModifier {
565- OmpGetUniqueModifier< ReductionModifier>(modifiers)} ) {
566- if (maybeModifier-> v == ReductionModifier::Value::Inscan) {
567- ResolveOmpObjectList (objList, Symbol::Flag::OmpInScanReduction);
560+ using ReductionModifier = parser::OmpReductionModifier;
561+ if ( auto *maybeModifier{
562+ OmpGetUniqueModifier<ReductionModifier>(modifiers)}) {
563+ if (maybeModifier-> v == ReductionModifier::Value::Inscan ) {
564+ ResolveOmpObjectList (objList, Symbol::Flag::OmpInScanReduction);
565+ }
568566 }
569567 }
570568 return false ;
0 commit comments