[flang-commits] [flang] [Flang][OpenMP] Reject substring and section-component in affinity (PR #184424)

via flang-commits flang-commits at lists.llvm.org
Wed Mar 4 18:55:49 PST 2026


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 cpp,h -- flang/lib/Semantics/check-omp-structure.cpp flang/lib/Semantics/check-omp-structure.h --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/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index ed383b091..b3acdde88 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -5711,21 +5711,22 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Affinity &x) {
             omp::GetDesignatorFromObj(object)}) {
       if (const auto *dataRef{GetDataRefFromObj(object)}) {
         if (const auto *arrayElement{GetArrayElementFromObj(object)}) {
-          CheckArraySection(
-              *arrayElement, GetLastName(*dataRef), llvm::omp::Clause::OMPC_affinity);
+          CheckArraySection(*arrayElement, GetLastName(*dataRef),
+              llvm::omp::Clause::OMPC_affinity);
         }
       }
 
       // CheckArraySection handles ArrayElement cases,
-      // but true substrings (e.g. a(2)(2:4)) are parser::Substring and bypass it.
+      // but true substrings (e.g. a(2)(2:4)) are parser::Substring and bypass
+      // it.
       if (std::holds_alternative<parser::Substring>(designator->u)) {
         context_.Say(designator->source,
             "Substrings are not allowed on AFFINITY clause"_err_en_US);
         continue;
       }
 
-      // OpenMP 5.2 5.2.5 Array section: if a list item is an array section, the last
-      // part-ref of the list item must have a section subscript list.
+      // OpenMP 5.2 5.2.5 Array section: if a list item is an array section, the
+      // last part-ref of the list item must have a section subscript list.
       CheckLastPartRefForArraySection(
           *designator, llvm::omp::Clause::OMPC_affinity);
     }

``````````

</details>


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


More information about the flang-commits mailing list