[flang-commits] [flang] [flang][OpenMP] Make `iv` const-reference to original parser::Name (PR #199727)
via flang-commits
flang-commits at lists.llvm.org
Tue May 26 09:46:27 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-semantics
Author: Krzysztof Parzyszek (kparzysz)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/199727.diff
2 Files Affected:
- (modified) flang/include/flang/Semantics/openmp-utils.h (+1-1)
- (modified) flang/lib/Semantics/openmp-utils.cpp (+5-5)
``````````diff
diff --git a/flang/include/flang/Semantics/openmp-utils.h b/flang/include/flang/Semantics/openmp-utils.h
index ab7a09e4ca721..06cb71845f60a 100644
--- a/flang/include/flang/Semantics/openmp-utils.h
+++ b/flang/include/flang/Semantics/openmp-utils.h
@@ -154,7 +154,7 @@ struct LoopControl {
LoopControl(const parser::LoopControl::Bounds &x);
LoopControl(const parser::ConcurrentControl &x);
- parser::Name iv;
+ const parser::Name &iv;
WithSource<MaybeExpr> lbound, ubound, step;
private:
diff --git a/flang/lib/Semantics/openmp-utils.cpp b/flang/lib/Semantics/openmp-utils.cpp
index b615900672042..d07a7c4183734 100644
--- a/flang/lib/Semantics/openmp-utils.cpp
+++ b/flang/lib/Semantics/openmp-utils.cpp
@@ -613,8 +613,8 @@ static bool IsTransformableLoop(const parser::ExecutionPartConstruct &epc) {
return false;
}
-LoopControl::LoopControl(const parser::LoopControl::Bounds &x) {
- iv = x.Name().thing;
+LoopControl::LoopControl(const parser::LoopControl::Bounds &x)
+ : iv(x.Name().thing) {
lbound = fromParserExpr(parser::UnwrapRef<parser::Expr>(x.Lower()));
ubound = fromParserExpr(parser::UnwrapRef<parser::Expr>(x.Upper()));
if (auto &inc{x.Step()}) {
@@ -622,9 +622,9 @@ LoopControl::LoopControl(const parser::LoopControl::Bounds &x) {
}
}
-LoopControl::LoopControl(const parser::ConcurrentControl &x) {
- auto &[name, lower, upper, inc]{x.t};
- iv = name;
+LoopControl::LoopControl(const parser::ConcurrentControl &x)
+ : iv(std::get<parser::Name>(x.t)) {
+ auto &[_, lower, upper, inc]{x.t};
lbound = fromParserExpr(parser::UnwrapRef<parser::Expr>(lower));
ubound = fromParserExpr(parser::UnwrapRef<parser::Expr>(upper));
if (inc) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/199727
More information about the flang-commits
mailing list