[clang] [clang] Limit lifetimes of temporaries to the full expression (PR #170517)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 3 13:44:02 PST 2025
================
@@ -4947,7 +4948,23 @@ void CodeGenFunction::EmitCallArg(CallArgList &args, const Expr *E,
return;
}
- args.add(EmitAnyExprToTemp(E), type);
+ AggValueSlot ArgSlot = AggValueSlot::ignored();
+ // If the callee returns a reference, skip this stack saving optimization;
----------------
efriedma-quic wrote:
Oh, just went through D74094... I think I understand the context, but those cases seem to just be use-after-free.
In any case, this initial patch should be conservative enough that it's unlikely to cause issues.
https://github.com/llvm/llvm-project/pull/170517
More information about the cfe-commits
mailing list