[clang] [CIR] Add support for ternary operator as lvalue (PR #163580)

Morris Hafner via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 20 06:59:23 PDT 2025


================
@@ -2394,6 +2394,185 @@ LValue CIRGenFunction::emitPredefinedLValue(const PredefinedExpr *e) {
   return emitStringLiteralLValue(sl, gvName);
 }
 
+LValue CIRGenFunction::emitOpaqueValueLValue(const OpaqueValueExpr *e) {
+  assert(OpaqueValueMappingData::shouldBindAsLValue(e));
+  return getOrCreateOpaqueLValueMapping(e);
+}
+
+namespace {
+// Handle the case where the condition is a constant evaluatable simple integer,
+// which means we don't have to separately handle the true/false blocks.
+std::optional<LValue> handleConditionalOperatorLValueSimpleCase(
----------------
mmha wrote:

Just added a couple of new cases for `true/false ? a : b`.

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


More information about the cfe-commits mailing list