[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:22:21 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:
Oh my bad, now I remember why is it here. Just like with the `ExprWithCleanups` above, this does not show up in the CFG as an individual element. I could add a special case when we handle the binary conditional expression but I think it is more universal here (it also is impactful when this shows up at a different place).
https://github.com/llvm/llvm-project/pull/204439
More information about the cfe-commits
mailing list