[cfe-commits] r158871 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/tentative-property-decl.m

Fariborz Jahanian fjahanian at apple.com
Wed Jun 20 16:18:57 PDT 2012


Author: fjahanian
Date: Wed Jun 20 18:18:57 2012
New Revision: 158871

URL: http://llvm.org/viewvc/llvm-project?rev=158871&view=rev
Log:
objc: tweak my last patch to warn if class extension
has not overridden the property. // rdar://11656982

Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
    cfe/trunk/test/SemaObjC/tentative-property-decl.m

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=158871&r1=158870&r2=158871&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Wed Jun 20 18:18:57 2012
@@ -612,7 +612,6 @@
   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 @@
       }
     }
     if (ClassExtProperty) {
+      warn = false;
       unsigned classExtPropertyAttr = 
         ClassExtProperty->getPropertyAttributesAsWritten();
       // We are issuing the warning that we postponed because class extensions

Modified: cfe/trunk/test/SemaObjC/tentative-property-decl.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/tentative-property-decl.m?rev=158871&r1=158870&r2=158871&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/tentative-property-decl.m (original)
+++ cfe/trunk/test/SemaObjC/tentative-property-decl.m Wed Jun 20 18:18:57 2012
@@ -15,6 +15,7 @@
 
 @interface MyClass : Super
 @property(nonatomic, copy, readonly) NSString *prop;
+ at property(nonatomic, copy, readonly) id warnProp; // expected-warning {{property attributes 'readonly' and 'copy' are mutually exclusive}}
 @end
 
 @interface MyClass ()
@@ -23,11 +24,13 @@
 
 @implementation MyClass
 @synthesize prop;
+ at synthesize warnProp;
 @end
 
 
 @protocol P
 @property(nonatomic, copy, readonly) NSString *prop;
+ at 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;
+ at synthesize warnProp;
 @end
 





More information about the cfe-commits mailing list