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

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 18 04:05:47 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);
----------------
Xazax-hun wrote:

I think so, sure! 

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


More information about the cfe-commits mailing list