================
@@ -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:

There isn't any logic here that checks whether the callee returns a reference.  
And such a check wouldn't be useful, anyway; we can't catch all the ways a user 
could stash away a pointer.

I think the correct explanation is something like this:

```
// For arguments with aggregate type, create an alloca to store
// the value.  If the argument's type has a destructor, that destructor
// will run at the end of the full-expression; emit matching lifetime
// markers.
//
// FIXME: For types which don't have a destructor, consider using a
// narrower lifetime bound.
```

And then #170518 implements the FIXME.

https://github.com/llvm/llvm-project/pull/170517
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to