[flang-commits] [flang] [Flang][OpenMP] Improve Semantics for Derived Type Array Elements (PR #167296)
via flang-commits
flang-commits at lists.llvm.org
Mon Nov 10 02:52:29 PST 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 cpp,h -- flang/include/flang/Evaluate/tools.h flang/lib/Evaluate/tools.cpp flang/lib/Semantics/check-omp-structure.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/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp
index a26c862d0..efd84a486 100644
--- a/flang/lib/Evaluate/tools.cpp
+++ b/flang/lib/Evaluate/tools.cpp
@@ -1211,7 +1211,8 @@ bool HasConstant(const Expr<SomeType> &expr) {
}
// HasStructureComponent()
-struct HasStructureComponentHelper : public AnyTraverse<HasStructureComponentHelper, bool, false> {
+struct HasStructureComponentHelper
+ : public AnyTraverse<HasStructureComponentHelper, bool, false> {
using Base = AnyTraverse<HasStructureComponentHelper, bool, false>;
HasStructureComponentHelper() : Base(*this) {}
using Base::operator();
@@ -1222,9 +1223,7 @@ struct HasStructureComponentHelper : public AnyTraverse<HasStructureComponentHel
bool operator()(const NamedEntity &NamedEntity) const {
return NamedEntity.UnwrapComponent() != nullptr;
}
- bool operator()(const Component &) const {
- return true;
- }
+ bool operator()(const Component &) const { return true; }
};
bool HasStructureComponent(const Expr<SomeType> &expr) {
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 317cd49b7..381778835 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -4673,13 +4673,14 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Copyin &x) {
void OmpStructureChecker::CheckStructureComponent(
const parser::OmpObjectList &objects, llvm::omp::Clause clauseId) {
auto CheckComponent{[&](const parser::Designator &designator) {
- if (const parser::DataRef *dataRef{std::get_if<parser::DataRef>(&designator.u)}) {
+ if (const parser::DataRef *dataRef{
+ std::get_if<parser::DataRef>(&designator.u)}) {
if (!IsDataRefTypeParamInquiry(dataRef)) {
const auto expr = AnalyzeExpr(context_, designator);
if (expr.has_value() && evaluate::HasStructureComponent(expr.value())) {
context_.Say(designator.source,
- "A variable that is part of another variable cannot appear on the %s clause"_err_en_US,
- parser::ToUpperCaseLetters(getClauseName(clauseId).str()));
+ "A variable that is part of another variable cannot appear on the %s clause"_err_en_US,
+ parser::ToUpperCaseLetters(getClauseName(clauseId).str()));
}
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/167296
More information about the flang-commits
mailing list