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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to