[flang-commits] [flang] [flang] Add parser support for Fortran 2023 conditional arguments (F2023 R1526-R1528) (PR #191303)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Sun Apr 19 08:46:41 PDT 2026
================
@@ -1739,6 +1739,30 @@ class UnparseVisitor {
void Unparse(const ActualArg::PercentVal &x) {
Word("%VAL("), Walk(x.v), Put(')');
}
+ void Unparse(const ConditionalArg &x) { // F2023 R1526
+ Put("( ");
+ Walk(std::get<ScalarLogicalExpr>(x.t));
+ Put(" ? ");
+ Walk(std::get<ConditionalArg::Consequent>(x.t));
+ Put(" : ");
+ Walk(std::get<common::Indirection<ConditionalArgTail>>(x.t));
----------------
eugeneepshteyn wrote:
Maybe extract this into a small helper, which could be called from here and from `[&](const ConditionalArg &y)` visitor below? This will ensure that arg walking code will not get out of sync by accident.
If don't want to introduce a helper, at least add a comment to both places that any modifications need to happen synchronously.
https://github.com/llvm/llvm-project/pull/191303
More information about the flang-commits
mailing list