[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:37 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;
----------------
DavidTruby wrote:

nit: either don't create a new variable here, or just leave it as a pointer rather than dereferencing and then referencing it?
E.g. 
```
auto *newSymbol{namePair.first->second};
name->symbol = newSymbol;
```
I was a little confused by it turning into a reference and then back into a pointer.

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


More information about the flang-commits mailing list