]> granicus.if.org Git - clang/commitdiff
Objective-C: Removes a bogus warning about auto-synthesis
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 7 Jun 2013 18:32:55 +0000 (18:32 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 7 Jun 2013 18:32:55 +0000 (18:32 +0000)
of properties. Fixes // rdar://14085456

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

lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/default-synthesize-3.m

index 7770bbde628d2bc7083830c4de2b0827b5b31def..7f555857c848ae91a465800f5f2bab8c03ba4295 100644 (file)
@@ -1673,16 +1673,6 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
     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(Scope *S, ObjCImplDecl* IMPDecl,
       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(), 
index 82f968da000941cceeb122d2a2028e221bbc5368..9977239b38fdadcfe6930263d4227b4f0f4f035a 100644 (file)
@@ -111,3 +111,21 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
 
 @implementation S
 @end
+
+// rdar://14085456
+// No warning must be issued in this test.
+@interface ParentObject
+@end
+
+@protocol TestObject 
+@property (readonly) int six;
+@end
+
+@interface TestObject : ParentObject <TestObject>
+@property int six;
+@end
+
+@implementation TestObject
+@synthesize six;
+@end
+