r176906 - Objective-C: In my last path, also check

jahanian fjahanian at apple.com
Wed Mar 20 18:20:03 PDT 2013


On Mar 19, 2013, at 4:07 PM, Argyrios Kyrtzidis <kyrtzidis at apple.com> wrote:

> 
> On Mar 12, 2013, at 3:22 PM, Fariborz Jahanian <fjahanian at apple.com> wrote:
> 
>> Author: fjahanian
>> Date: Tue Mar 12 17:22:38 2013
>> New Revision: 176906
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=176906&view=rev
>> Log:
>> Objective-C: In my last path, also check
>> for existence of user setter before 
>> issuing the warning about non-synthesizable
>> property. // rdar://13388503
> 
> The warning is supposed to go away if the compiler can see the setter, is this right ?
> These cases still display the warning:

Yes, both of these cases should not produce a warning. I will look into this.

- Thanks, Fariborz

> 
> 1)
> 
> @interface B
> @property (readonly) id prop;
> @end
> 
> @interface B()
> -(void)setProp:(id)x;
> @end
> 
> @interface S : B
> @property (assign,readwrite) id prop;
> @end
> 
> @implementation S
> @end
> 
> 2)
> 
> @interface B
> @property (readonly) id prop;
> @end
> 
> @interface B(cat)
> @property (readwrite) id prop;
> @end
> 
> @interface S : B
> @property (assign,readwrite) id prop;
> @end
> 
> @implementation S
> @end
> 
> 
> Shouldn't the warning be suppressed ?
> 
> -Argyrios
> 
>> 
>> Modified:
>>    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>>    cfe/trunk/test/SemaObjC/default-synthesize-3.m
>> 
>> Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=176906&r1=176905&r2=176906&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue Mar 12 17:22:38 2013
>> @@ -1589,7 +1589,8 @@ void Sema::DefaultSynthesizeProperties(S
>>       ObjCPropertyDecl *PropInSuperClass = SuperPropMap[Prop->getIdentifier()];
>>       if ((Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) &&
>>           (PropInSuperClass->getPropertyAttributes() &
>> -           ObjCPropertyDecl::OBJC_PR_readonly)) {
>> +           ObjCPropertyDecl::OBJC_PR_readonly) &&
>> +          !IMPDecl->getInstanceMethod(Prop->getSetterName())) {
>>             Diag(Prop->getLocation(), diag::warn_no_autosynthesis_property)
>>               << Prop->getIdentifier()->getName();
>>             Diag(PropInSuperClass->getLocation(), diag::note_property_declare);
>> 
>> Modified: cfe/trunk/test/SemaObjC/default-synthesize-3.m
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize-3.m?rev=176906&r1=176905&r2=176906&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/SemaObjC/default-synthesize-3.m (original)
>> +++ cfe/trunk/test/SemaObjC/default-synthesize-3.m Tue Mar 12 17:22:38 2013
>> @@ -44,6 +44,7 @@ __attribute ((objc_requires_property_def
>> @interface NSObject @end
>> @protocol Foo
>> @property (readonly) char isFoo; // expected-note {{property declared here}}
>> + at property (readonly) char isNotFree;
>> @end
>> 
>> @interface Bar : NSObject <Foo>
>> @@ -53,6 +54,9 @@ __attribute ((objc_requires_property_def
>> - (char)isFoo {
>>     return 0;
>> }
>> +- (char)isNotFree {
>> +    return 0;
>> +}
>> @end
>> 
>> @interface Baz : Bar
>> @@ -62,10 +66,17 @@ __attribute ((objc_requires_property_def
>> @property (readwrite) char isFoo; // expected-warning {{auto property synthesis will not synthesize property 'isFoo' because it is 'readwrite' but it will be synthesized 'readonly' via another property}}
>> @property char Property1; // expected-warning {{auto property synthesis will not synthesize property 'Property1' because it cannot share an ivar with another synthesized property}}
>> @property char Property2;
>> + at property (readwrite) char isNotFree;
>> @end
>> 
>> @implementation Baz {
>>     char _isFoo;
>> +    char _isNotFree;
>> }
>> @synthesize Property2 = Property1; // expected-note {{property synthesized here}}
>> +
>> +- (void) setIsNotFree : (char)Arg {
>> +  _isNotFree = Arg;
>> +}
>> +
>> @end
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130320/37b725b1/attachment.html>


More information about the cfe-commits mailing list