r183542 - Objective-C: Removes a bogus warning about auto-synthesis

Fariborz Jahanian fjahanian at apple.com
Fri Jun 7 11:32:55 PDT 2013


Author: fjahanian
Date: Fri Jun  7 13:32:55 2013
New Revision: 183542

URL: http://llvm.org/viewvc/llvm-project?rev=183542&view=rev
Log:
Objective-C: Removes a bogus warning about auto-synthesis
of properties. Fixes // rdar://14085456

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=183542&r1=183541&r2=183542&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Jun  7 13:32:55 2013
@@ -1673,16 +1673,6 @@ void Sema::DefaultSynthesizeProperties(S
     if (Prop->isInvalidDecl() ||
         Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional)
       continue;
-    if (ObjCPropertyImplDecl *PID =
-          IMPDecl->FindPropertyImplIvarDecl(Prop->getIdentifier())) {
-      if (PID->getPropertyDecl() != Prop) {
-        Diag(Prop->getLocation(), diag::warn_no_autosynthesis_shared_ivar_property)
-          << Prop->getIdentifier()->getName();
-        if (!PID->getLocation().isInvalid())
-          Diag(PID->getLocation(), diag::note_property_synthesize);
-      }
-      continue;
-    }
     // Property may have been synthesized by user.
     if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier()))
       continue;
@@ -1692,6 +1682,16 @@ void Sema::DefaultSynthesizeProperties(S
       if (IMPDecl->getInstanceMethod(Prop->getSetterName()))
         continue;
     }
+    if (ObjCPropertyImplDecl *PID =
+        IMPDecl->FindPropertyImplIvarDecl(Prop->getIdentifier())) {
+      if (PID->getPropertyDecl() != Prop) {
+        Diag(Prop->getLocation(), diag::warn_no_autosynthesis_shared_ivar_property)
+        << Prop->getIdentifier()->getName();
+        if (!PID->getLocation().isInvalid())
+          Diag(PID->getLocation(), diag::note_property_synthesize);
+      }
+      continue;
+    }
     if (isa<ObjCProtocolDecl>(Prop->getDeclContext())) {
       // We won't auto-synthesize properties declared in protocols.
       Diag(IMPDecl->getLocation(), 

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=183542&r1=183541&r2=183542&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize-3.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize-3.m Fri Jun  7 13:32:55 2013
@@ -111,3 +111,21 @@ __attribute ((objc_requires_property_def
 
 @implementation S
 @end
+
+// rdar://14085456
+// No warning must be issued in this test.
+ at interface ParentObject
+ at end
+
+ at protocol TestObject 
+ at property (readonly) int six;
+ at end
+
+ at interface TestObject : ParentObject <TestObject>
+ at property int six;
+ at end
+
+ at implementation TestObject
+ at synthesize six;
+ at end
+





More information about the cfe-commits mailing list