================
@@ -4681,6 +4682,14 @@ void CallArg::copyInto(CodeGenFunction &CGF, Address 
Addr) const {
   IsUsed = true;
 }
 
+void CodeGenFunction::EmitWritebacks(CodeGenFunction &CGF,
+                                     const CallArgList &Args) {
+  if (getTarget().getCXXABI().areArgsDestroyedLeftToRightInCallee())
+    std::reverse_iterator(Args.writebacks().begin());
----------------
bogner wrote:

This looks broken - creating a `reverse_iterator` and not doing anything with 
it doesn't reverse anything. I think you meant `Args.reverseWritebacks()` here, 
and we clearly need to exercise this in tests.

That said, the `Args` argument here is const for a reason - I don't think it's 
appropriate to be modifying the `CallArgList` in a function that just says it's 
emitting writebacks. Is this really the right place to do this?

Finally, it's a bit of a code smell to have a public member function that just 
calls out to a `static` function like this. It might be better to remove the 
`emitWritebacks` function and only have `CodeGenFunction::EmitWritebacks` if we 
need to access this outside of the file.

https://github.com/llvm/llvm-project/pull/109331
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to