]> granicus.if.org Git - clang/commitdiff
objc: tweak my last patch to warn if class extension
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 20 Jun 2012 23:18:57 +0000 (23:18 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 20 Jun 2012 23:18:57 +0000 (23:18 +0000)
has not overridden the property. // rdar://11656982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158871 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/tentative-property-decl.m

index 32fbb0432ad4570b8ff7e3d225e63337a89873eb..13350eaf37c2519abad1220f626f39935932f6c6 100644 (file)
@@ -612,7 +612,6 @@ DiagnoseClassAndClassExtPropertyMismatch(Sema &S, ObjCInterfaceDecl *ClassDecl,
   bool warn = (Attributes & ObjCDeclSpec::DQ_PR_readonly);
   for (const ObjCCategoryDecl *CDecl = ClassDecl->getFirstClassExtension();
        CDecl; CDecl = CDecl->getNextClassExtension()) {
-    warn = false;
     ObjCPropertyDecl *ClassExtProperty = 0;
     for (ObjCContainerDecl::prop_iterator P = CDecl->prop_begin(),
          E = CDecl->prop_end(); P != E; ++P) {
@@ -622,6 +621,7 @@ DiagnoseClassAndClassExtPropertyMismatch(Sema &S, ObjCInterfaceDecl *ClassDecl,
       }
     }
     if (ClassExtProperty) {
+      warn = false;
       unsigned classExtPropertyAttr = 
         ClassExtProperty->getPropertyAttributesAsWritten();
       // We are issuing the warning that we postponed because class extensions
index 4ab2f56a4a4fa32e7d9dcc53eff7970a23ec58c7..f69ac6dace431106fad9824cf82bae3d1b57e009 100644 (file)
@@ -15,6 +15,7 @@
 
 @interface MyClass : Super
 @property(nonatomic, copy, readonly) NSString *prop;
+@property(nonatomic, copy, readonly) id warnProp; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
 @end
 
 @interface MyClass ()
 
 @implementation MyClass
 @synthesize prop;
+@synthesize warnProp;
 @end
 
 
 @protocol P
 @property(nonatomic, copy, readonly) NSString *prop;
+@property(nonatomic, copy, readonly) id warnProp; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
 @end
 
 @interface YourClass : Super <P>
@@ -39,5 +42,6 @@
 
 @implementation YourClass 
 @synthesize prop;
+@synthesize warnProp;
 @end