]> granicus.if.org Git - clang/commitdiff
Don't error when doing default property synthesis
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 14 Jul 2010 18:11:52 +0000 (18:11 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 14 Jul 2010 18:11:52 +0000 (18:11 +0000)
and some are already synthesized by user declaration.

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

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

index b2b6e13717e47144be89068d66c03e06b8075252..ff60599b8510ae5a22bba1aea54d9baaa49990f5 100644 (file)
@@ -930,6 +930,10 @@ void Sema::DefaultSynthesizeProperties (Scope *S, ObjCImplDecl* IMPDecl,
         Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional ||
         IMPDecl->FindPropertyImplIvarDecl(Prop->getIdentifier()))
       continue;
+    // Property may have been synthesized by user.
+    if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier()))
+      continue;
+
     ActOnPropertyImplDecl(S, IMPDecl->getLocation(), IMPDecl->getLocation(),
                           true, DeclPtrTy::make(IMPDecl),
                           Prop->getIdentifier(), Prop->getIdentifier());
index 283ad260a94e50366dd28af59a12b3e188082b93..0586daea87964a0ec098df149372b80ad7497afb 100644 (file)
 @implementation C (Category) // expected-note 2 {{implementation is here}}
 @end
 
+// Don't complain if a property is already @synthesized by usr.
+@interface D
+{
+}
+@property int PROP;
+@end
+
+@implementation D
+- (int) Meth { return self.PROP; }
+@synthesize PROP=IVAR;
+@end
+