[flang-commits] [flang] [flang] Implement conditional expressions parser/semantics (F2023) (PR #186489)
via flang-commits
flang-commits at lists.llvm.org
Tue Mar 31 04:08:48 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)}) {
----------------
jeanPerier wrote:
I would not even bother visiting the `elseValue()`, the use case for this tool is to analyze and verify atomic operations for OpenMP/OpenACC and I do not a conditional expression makes much sense there. So without a clear use case, extracting the direct argument seems good enough.
https://github.com/llvm/llvm-project/pull/186489
More information about the flang-commits
mailing list