[clang] [LifetimeSafety] Propagate loans through the GNU binary conditional (PR #204439)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 03:50:59 PDT 2026


================
@@ -222,6 +222,12 @@ OriginList *OriginManager::getOrCreateList(const Expr *E) {
   if (const ExprWithCleanups *EWC = dyn_cast<ExprWithCleanups>(E))
     return getOrCreateList(EWC->getSubExpr());
 
+  // An OpaqueValueExpr is a placeholder for an already-evaluated subexpression
+  // (e.g. the common operand of `a ?: b`); reuse its source's origins.
+  if (const auto *OVE = dyn_cast<OpaqueValueExpr>(E))
+    if (const Expr *Src = OVE->getSourceExpr())
+      return getOrCreateList(Src);
----------------
usx95 wrote:

Would creating a flow from Src to OVE work instead?

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


More information about the cfe-commits mailing list