[PATCH] D131701: [CodeGen][ObjC] Call synthesized copy constructor/assignment operator functions in getter/setter functions of non-trivial C struct properties
Akira Hatanaka via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 1 14:54:31 PDT 2022
ahatanak added inline comments.
================
Comment at: clang/lib/CodeGen/CGObjC.cpp:1429
+ GetAddrOfLocalVar(*setterMethod->param_begin()), ivar->getType());
+ callCStructCopyAssignmentOperator(Dst, Src);
+ } else {
----------------
rjmccall wrote:
> When the method takes the structure by value, we're passed an owned copy with the responsibility to destroy it in the method, right? Is there a way for us to do a destructive move-assignment here and suppress the normal destruction of the parameter?
We could check whether a function parameter is a setter parameter and avoid pushing the cleanup for it if it is.
If you are thinking about a more general way of merging copy+destruction into a move, I think we need to take a different approach.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131701/new/
https://reviews.llvm.org/D131701
More information about the cfe-commits
mailing list