[flang-commits] [flang] [flang] Implement conditional expressions parser/semantics (F2023) (PR #186489)

Krzysztof Parzyszek via flang-commits flang-commits at lists.llvm.org
Wed Apr 1 07:41:11 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)}) {
----------------
kparzysz wrote:

Correct. In OpenMP only the top-level conditional operator would be considered.  We wouldn't explicitly look for chained conditionals, but if the top-level arguments failed additional semantic requirements, they would be rejected.  We don't need to have any details about the structure of the arguments, just the arguments themselves.

https://github.com/llvm/llvm-project/pull/186489


More information about the flang-commits mailing list