[flang-commits] [flang] [flang] Implement conditional expressions parser/semantics (F2023) (PR #186489)
Caroline Newcombe via flang-commits
flang-commits at lists.llvm.org
Wed Apr 1 07:28:38 PDT 2026
================
@@ -1736,6 +1729,18 @@ struct ArgumentExtractor
return {operation::OperationCode(x), {AsSomeExpr(x)}};
}
+ template <typename T> Result operator()(const ConditionalExpr<T> &x) const {
+ // ConditionalExpr is a top-level operation; collect its immediate operands
+ Arguments args{AsSomeExpr(x.condition()), AsSomeExpr(x.thenValue())};
+ if (const auto *nested{std::get_if<ConditionalExpr<T>>(&x.elseValue().u)}) {
----------------
cenewcombe wrote:
@kparzysz ah, thanks for pointing that out! I'll fix the comment, which is inaccurate. I think the simplification (returning the condition, then-value, and else-value as flat operands) is still correct for this purpose? My reading of the OpenMP standard is that chained conditionals are not allowed in atomic constructs, so not recursing into nested conditionals should be fine — but please let me know if I'm misreading that.
https://github.com/llvm/llvm-project/pull/186489
More information about the flang-commits
mailing list