[cfe-dev] CodeGen help for a new feature in ObjC
John McCall
rjmccall at apple.com
Wed Dec 21 12:50:48 PST 2011
On Dec 21, 2011, at 2:23 AM, Remy Demarest wrote:
> I have one last detail to solve before I'm done with this feature.
>
> The principle of this feature is that the storage in the block structure (be it on the stack or the heap) is __weak, but the local variables and the variables inside the block are not __weak, they would be strong usually.
>
> My problem is that I can't figure out how to make weak setup to happen, I know I have to call EmitARCInitWeak() to initialize the capture field, but I don't know what parameters I have to pass at this point. The place where my code is supposed to be inserted uses a fake POD loading to put the expected value into the variable... Trying to reduce the code doesn't work very well sadly.
This is going to be a bit challenging because the type of the captured object doesn't match the type of the original object, and the AST is built up around that assumption.
You might be able to make it work just in CGBlocks.cpp, without any AST changes.
Incidentally, you're aware that this work will not be welcome in trunk, right?
John.
More information about the cfe-dev
mailing list