[llvm-branch-commits] [clang] [clang] Introduce scopes for arguments without destructors (PR #191019)

Eli Friedman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 8 15:10:27 PDT 2026


================
@@ -6872,6 +6893,15 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
   assert(CalleeType->isFunctionPointerType() &&
          "Call must have function pointer type!");
 
+  // For calls with trivial aggregate arguments, we want to tighten the
+  // lifetime of those aggregates to end immediately after the call returns,
+  // rather than at the end of the full-expression. We create a nested cleanup
+  // scope to intercept these lifetime markers. However, we only do this if the
+  // call is "safe".
----------------
efriedma-quic wrote:

This is a bit more conservative than a per-argument approach: if a call has both trivial and non-trivial arguments, this extends the lifetimes of the trivial arguments when that isn't necessary.

Maybe good enough, though.  I guess we can improve it later.

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


More information about the llvm-branch-commits mailing list