[PATCH] D69991: Implement __attribute__((objc_direct)), __attribute__((objc_direct_members))
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 13 08:08:42 PST 2019
rjmccall added inline comments.
================
Comment at: clang/lib/CodeGen/CGObjCMac.cpp:4095
+ Builder.CreateStore(result.getScalarVal(),
+ CGF.GetAddrOfLocalVar(OMD->getSelfDecl()));
+
----------------
MadCoder wrote:
> rjmccall wrote:
> > We should also be changing `selfValue` so that the null check below will do the right thing with e.g. subclasses of weak-linked classes, where IIUC the input value might be non-null but the initialized class pointer might be null.
> I'm not sure what you mean, wouldn't storing to `CGF.GetAddrOfLocalVar(OMD->getSelfDecl())` actually affect selfValue itself? I'm not 100% sure I understand what you mean here.
`selfValue` is just an ordinary C++ local variable which is initialized at the top of the function to the IR value for the first parameter. It doesn't track the "dynamic" value stored in a particular IR alloca.
Oh, and that's a bug, actually; the first parameter of the IR function is not necessarily `self` because of indirect return slots. You should be initializing `selfValue` to the result of a load from the `self` variable. And please add tests for direct methods (both instance and class) with indirect returns.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69991/new/
https://reviews.llvm.org/D69991
More information about the cfe-commits
mailing list