[flang-commits] [flang] [flang][OpenMP] Fix the attribute setting for OmpCommonBlock (PR #73676)

Leandro Lupori via flang-commits flang-commits at lists.llvm.org
Wed Nov 29 11:38:45 PST 2023


================
@@ -1989,16 +1989,15 @@ Symbol *OmpAttributeVisitor::ResolveOmpCommonBlockName(
     return nullptr;
   }
   // First check if the Common Block is declared in the current scope
-  if (auto *cur{GetContext().scope.FindCommonBlock(name->source)}) {
-    name->symbol = cur;
-    return cur;
-  }
+  Symbol *sym = GetContext().scope.FindCommonBlock(name->source);
   // Then check parent scope
-  if (auto *prev{GetContext().scope.parent().FindCommonBlock(name->source)}) {
-    name->symbol = prev;
-    return prev;
-  }
-  return nullptr;
+  if (!sym)
+    sym = GetContext().scope.parent().FindCommonBlock(name->source);
+  if (!sym)
+    return nullptr;
----------------
luporl wrote:

It seems to me that the preferred style in semantics is to always use braces, even with single statements.

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


More information about the flang-commits mailing list