[cfe-commits] r156999 - in /cfe/trunk: lib/ARCMigrate/TransRetainReleaseDealloc.cpp test/ARCMT/checking.m

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon May 21 10:55:15 PDT 2012


On May 19, 2012, at 12:21 AM, John McCall wrote:

> On May 17, 2012, at 11:16 AM, Argyrios Kyrtzidis wrote:
>> Author: akirtzidis
>> Date: Thu May 17 13:16:05 2012
>> New Revision: 156999
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=156999&view=rev
>> Log:
>> [arcmt] Remove the "it is not safe to remove an unused 'autorelease' message" ARC
>> migration error.
>> 
>> This is more trouble that it is worth; autoreleasing a value without holding on it
>> is a valid use-case, we should not "punish" correct code for the minority of
>> broken/fragile programs that depend on the behavior of  -autorelease.
>> 
>> rdar://9914061
> 
> I wish you'd asked me about this.  The user in question is doing an
> autorelease to avoid a temporary during an assignment operation.
> That seems like a perfectly reasonable idiom to recognize and so
> delete the autorelease.
> 
> However, I am not comfortable with deleting arbitrary instances of
>  [foo autorelease];
> because there are some common patterns in GUI programming
> where this is intentionally done to cause something to be deleted "later".
> For example, if -[Widget handleEvent] calls -[Controller nextPage] and
> the latter wants to destroy the widget, it might intentionally autorelease
> instead of releasing so that self won't disappear out from under
> -[Widget handleEvent].
> 
> Turning that into "delete this now" is just papering over problems
> that the user really ought to deal with during the migration process.

Thanks for the feedback! Reverted in r157198.

> 
> John.




More information about the cfe-commits mailing list