[flang-commits] [flang] [flang][OpenACC] Relax COMMON block usage restriction in OpenACC directives (PR #162659)

via flang-commits flang-commits at lists.llvm.org
Thu Oct 16 19:08:46 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- flang/include/flang/Semantics/scope.h flang/lib/Semantics/resolve-directives.cpp flang/lib/Semantics/resolve-names.cpp flang/lib/Semantics/scope.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 8c1fa3e68..411d2befe 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1732,8 +1732,8 @@ Symbol *AccAttributeVisitor::ResolveAccCommonBlockName(
   if (!name) {
     return nullptr;
   }
-  if (auto *cb{GetContext().scope.FindCommonBlockInVisibleScopes(
-          name->source)}) {
+  if (auto *cb{
+          GetContext().scope.FindCommonBlockInVisibleScopes(name->source)}) {
     name->symbol = cb;
     return cb;
   }
diff --git a/flang/lib/Semantics/scope.cpp b/flang/lib/Semantics/scope.cpp
index 1a720098c..fff0516ce 100644
--- a/flang/lib/Semantics/scope.cpp
+++ b/flang/lib/Semantics/scope.cpp
@@ -154,8 +154,7 @@ Symbol &Scope::MakeCommonBlock(SourceName name, SourceName location) {
   }
 }
 
-Symbol *Scope::FindCommonBlockInVisibleScopes(
-    const SourceName &name) const {
+Symbol *Scope::FindCommonBlockInVisibleScopes(const SourceName &name) const {
   if (Symbol * cb{FindCommonBlock(name)}) {
     return cb;
   } else if (Symbol * cb{FindCommonBlockUse(name)}) {

``````````

</details>


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


More information about the flang-commits mailing list