[ARC] Complain about property without storage attribute when @synthesizing it,...
[ARC] Complain about property without storage attribute when @synthesizing it, not at its declaration. For this sample: @interface Foo @property id x; @end we get: t.m:2:1: error: ARC forbids properties of Objective-C objects with unspecified storage attribute @property id x; ^ 1 error generated. The error should be imposed on the implementor of the interface, not the user. If the user uses a header of a non-ARC library whose source code he does not have, we are basically asking him to go change the header of the library (bad in general), possible overriding how the property is implemented if he gets confused and says "Oh I'll just add 'copy' then" (even worse). Second issue is that we don't emit any error for 'readonly' properties, e.g: @interface Foo @property (readonly) id x; // no error here @end @implementation Foo @synthesize x; // no error here too @end We should give an error when the implementor is @synthesizing a property which doesn't have any storage specifier; this is when the explicit specifier is important, because we are going to create an ivar and we want its ownership to be explicit. Related improvements: -OBJC_PR_unsafe_unretained turned out to not fit in ObjCPropertyDecl's bitfields, fix it. -For properties of extension classes don't drop PropertyAttributesAsWritten values. -Have PropertyAttributesAsWritten actually only reflect what the user wrote rdar://9756610. llvm-svn: 134960
Loading
Please register or sign in to comment