[cfe-dev] CodeGen help for a new feature in ObjC
Remy Demarest
remy.demarest at gmail.com
Tue Dec 20 11:00:28 PST 2011
I'll think I'll just KISS it and to the retain before the body emission and the do the release after the body implementation.
____________________________________
Remy "Psy" Demarest
remy.demarest at gmail.com
+1 (647) 862-1779
Le 20 déc. 2011 à 19:52, John McCall a écrit :
> On Dec 20, 2011, at 6:58 AM, Remy Demarest wrote:
>> So, my actual problem is in CodeGen. I've god the weak capture itself working, the compiler generates the objc_loadWeak() to store the captured variable in the block structure as a weak. What I'm missing is the retain and release inside the code and there I'm not sure how to work it out.
>
> This is because you're trying to generalize from straight-line code, where the scope and CFG concerns are trivial. In general, it is not possible to statically decide which use is the first use, and it is not possible to even dynamically decide which use is the last use. For example, when do you want the retains and releases to happen in this code?
>
> ^{ __weak_capture(self); for (…) { if (...) [self blah]; }
>
> John.
More information about the cfe-dev
mailing list