[flang-commits] [flang] [flang][OpenMP] Privatize vars referenced in statement functions (PR #103390)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Wed Aug 21 05:57:12 PDT 2024


================
@@ -2126,23 +2152,59 @@ void OmpAttributeVisitor::Post(const parser::Name &name) {
       // it would have the private flag set.
       // This would make x appear to be defined in p2, causing it to be
       // privatized in p2 and its privatization in p1 to be skipped.
-      auto makePrivateSymbol = [&](Symbol::Flag flag) {
-        Symbol *hostSymbol =
-            lastDeclSymbol ? lastDeclSymbol : &symbol->GetUltimate();
-        lastDeclSymbol = DeclarePrivateAccessEntity(
-            *hostSymbol, flag, context_.FindScope(dirContext.directiveSource));
-        return lastDeclSymbol;
+      // TODO Move the lambda functions below to a separate class.
----------------
luporl wrote:

Refactored using approach 2, which allowed for greater simplification of the code.

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


More information about the flang-commits mailing list