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

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Fri Nov 24 03:25:40 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;
----------------
kiranchandramohan wrote:

The change here is only moving code. We can fix this in a follow-up patch if required.
Also, note that `namePair.first->second`  is of type `Fortran::common::Reference<Fortran::semantics::Symbol>` and hence the code you provided will not directly work.

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


More information about the flang-commits mailing list