[flang-commits] [flang] [flang][OpenMP] Do not emit a use-only item for a reduction symbol in a module file (PR #207492)
via flang-commits
flang-commits at lists.llvm.org
Mon Jul 6 10:52:49 PDT 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 -- flang/lib/Semantics/mod-file.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/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index d66d2b79b..14718da5b 100644
--- a/flang/lib/Semantics/mod-file.cpp
+++ b/flang/lib/Semantics/mod-file.cpp
@@ -890,19 +890,20 @@ void ModFileWriter::PutGeneric(const Symbol &symbol) {
}
void ModFileWriter::PutUse(const Symbol &symbol) {
- // A declare reduction named by an operator has an internal mangled symbol name
+ // A declare reduction named by an operator has an internal mangled symbol
+ // name
// ("op.remote.", "op.+") that is not valid Fortran and cannot be emitted as a
// "use,only:" item (that module file could not be re-parsed, and reading it
- // crashed, both for a plain re-export and for an embedded module in a hermetic
- // module file). Its operator is itself re-exported as a valid item, and the
- // resolver recovers the reduction through it (FindUserReductionSymbol /
- // SearchOperatorReduction), keeping one shared reduction symbol, so skip the
- // reduction's own use item. This covers a defined operator (which always has a
- // mandatory "interface operator(.x.)") and an intrinsic operator with a user
- // "interface operator(+)". A reduction named by a plain identifier ("myred")
- // has a valid name and is emitted normally below. An operator-less reduction
- // (a special function, or an intrinsic operator on an intrinsic type) has no
- // operator to recover through and is left to the normal path.
+ // crashed, both for a plain re-export and for an embedded module in a
+ // hermetic module file). Its operator is itself re-exported as a valid item,
+ // and the resolver recovers the reduction through it (FindUserReductionSymbol
+ // / SearchOperatorReduction), keeping one shared reduction symbol, so skip
+ // the reduction's own use item. This covers a defined operator (which always
+ // has a mandatory "interface operator(.x.)") and an intrinsic operator with a
+ // user "interface operator(+)". A reduction named by a plain identifier
+ // ("myred") has a valid name and is emitted normally below. An operator-less
+ // reduction (a special function, or an intrinsic operator on an intrinsic
+ // type) has no operator to recover through and is left to the normal path.
const Symbol &ultimate{symbol.GetUltimate()};
if (ultimate.has<UserReductionDetails>()) {
std::string opId{GetReductionFortranId(ultimate.name())};
``````````
</details>
https://github.com/llvm/llvm-project/pull/207492
More information about the flang-commits
mailing list