r183556 - Objective-C: Another case of issuing warning about misusing

Fariborz Jahanian fjahanian at apple.com
Fri Jun 7 13:26:51 PDT 2013


Author: fjahanian
Date: Fri Jun  7 15:26:51 2013
New Revision: 183556

URL: http://llvm.org/viewvc/llvm-project?rev=183556&view=rev
Log:
Objective-C: Another case of issuing warning about misusing
property auto-synthesis before knowingit it is to be
auto-synthesized. // rdar://14094682

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=183556&r1=183555&r2=183556&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Jun  7 15:26:51 2013
@@ -1655,6 +1655,19 @@ void Sema::DefaultSynthesizeProperties(S
   
   for (unsigned i = 0, e = PropertyOrder.size(); i != e; i++) {
     ObjCPropertyDecl *Prop = PropertyOrder[i];
+    // Is there a matching property synthesize/dynamic?
+    if (Prop->isInvalidDecl() ||
+        Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional)
+      continue;
+    // Property may have been synthesized by user.
+    if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier()))
+      continue;
+    if (IMPDecl->getInstanceMethod(Prop->getGetterName())) {
+      if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly)
+        continue;
+      if (IMPDecl->getInstanceMethod(Prop->getSetterName()))
+        continue;
+    }
     // If property to be implemented in the super class, ignore.
     if (SuperPropMap[Prop->getIdentifier()]) {
       ObjCPropertyDecl *PropInSuperClass = SuperPropMap[Prop->getIdentifier()];
@@ -1669,19 +1682,6 @@ void Sema::DefaultSynthesizeProperties(S
       }
       continue;
     }
-    // Is there a matching property synthesize/dynamic?
-    if (Prop->isInvalidDecl() ||
-        Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional)
-      continue;
-    // Property may have been synthesized by user.
-    if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier()))
-      continue;
-    if (IMPDecl->getInstanceMethod(Prop->getGetterName())) {
-      if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly)
-        continue;
-      if (IMPDecl->getInstanceMethod(Prop->getSetterName()))
-        continue;
-    }
     if (ObjCPropertyImplDecl *PID =
         IMPDecl->FindPropertyImplIvarDecl(Prop->getIdentifier())) {
       if (PID->getPropertyDecl() != Prop) {

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=183556&r1=183555&r2=183556&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize-3.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize-3.m Fri Jun  7 15:26:51 2013
@@ -129,3 +129,28 @@ __attribute ((objc_requires_property_def
 @synthesize six;
 @end
 
+// rdar://14094682
+// no warning in this test
+ at interface ISAChallenge : NSObject {
+}
+
+ at property (assign, readonly) int failureCount;
+ at end
+
+ at interface ISSAChallenge : ISAChallenge {
+    int _failureCount;
+}
+ at property (assign, readwrite) int failureCount;
+ at end
+
+ at implementation ISAChallenge
+- (int)failureCount {
+    return 0;
+}
+ at end
+
+ at implementation ISSAChallenge
+
+ at synthesize failureCount = _failureCount;
+ at end
+





More information about the cfe-commits mailing list