[cfe-commits] r161458 - in /cfe/trunk: lib/Sema/SemaExpr.cpp lib/Sema/SemaExprMember.cpp test/SemaObjC/warn-direct-ivar-access.m

jahanian fjahanian at apple.com
Thu Aug 23 09:14:11 PDT 2012


On Aug 22, 2012, at 11:04 PM, Douglas Gregor wrote:

> 
> On Aug 19, 2012, at 3:23 PM, John McCall <rjmccall at apple.com> wrote:
> 
>> On Aug 8, 2012, at 9:16 AM, Douglas Gregor wrote:
>>> In both cases, why do we restrict this warning to ivars of Objective-C pointer type? Direct ivar access to an 'int' ivar is still direct access to an ivar, when one should presumably go through a property or method.
>> 
>> Doug, it is pretty clear from the restrictions that the original design of this warning
>> was to tell users when they might be directly accessing an ivar in a way that
>> broke memory safety.  Your reviews have completely repurposed the warning flag
>> to instead warn about all places that could have been property accesses.
> 
> You're right. I was thinking of this warning in terms of KVO and current recommendations that one go through the property rather than the ivar, but (historically) this warning would have simply been about memory safety in a non-GC, non-ARC world.
> 
>> That
>> might be abstractly okay, but does it satisfy the intent of the feature request?
> 
> 
> Hrm. My interpretation tends to push this warning close to the point of being stylistic, because ubiquitous use of property accesses is a recommendation that isn't necessarily universally agreed upon. In that light, I think I've asked for a warning that is going to produce too many false positives to be generally useful. We'd probably be better off dialing it back to the original intent. Sorry, Fariborz!

No sweat. Will undo.
- Fariborz

> 
> 	- Doug




More information about the cfe-commits mailing list