[flang-commits] [flang] [Flang][OpenMP] Consider renames when processing reduction intrinsics (PR #70822)

David Truby via flang-commits flang-commits at lists.llvm.org
Mon Nov 20 08:37:36 PST 2023


================
@@ -480,21 +480,28 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
   bool Pre(const parser::OmpClause::Reduction &x) {
     const parser::OmpReductionOperator &opr{
         std::get<parser::OmpReductionOperator>(x.v.t)};
+    auto createDummyProcSymbol = [&](const parser::Name *name) {
+      // If name resolution failed, create a dummy symbol
+      const auto namePair{
+          currScope().try_emplace(name->source, Attrs{}, ProcEntityDetails{})};
+      auto &newSymbol{*namePair.first->second};
+      name->symbol = &newSymbol;
+    };
     if (const auto *procD{parser::Unwrap<parser::ProcedureDesignator>(opr.u)}) {
       if (const auto *name{parser::Unwrap<parser::Name>(procD->u)}) {
         if (!name->symbol) {
-          const auto namePair{currScope().try_emplace(
-              name->source, Attrs{}, ProcEntityDetails{})};
-          auto &symbol{*namePair.first->second};
-          name->symbol = &symbol;
-          name->symbol->set(Symbol::Flag::OmpReduction);
----------------
DavidTruby wrote:

Should the new symbol above also be set as an OmpReduction symbol? It doesn't look like this is getting set anymore

https://github.com/llvm/llvm-project/pull/70822


More information about the flang-commits mailing list