From: Fariborz Jahanian Date: Wed, 14 Jul 2010 18:11:52 +0000 (+0000) Subject: Don't error when doing default property synthesis X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3635b9681daaef74974932f77080910b032b9fd;p=clang Don't error when doing default property synthesis 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 --- diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index b2b6e13717..ff60599b85 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -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()); diff --git a/test/SemaObjC/default-synthesize.m b/test/SemaObjC/default-synthesize.m index 283ad260a9..0586daea87 100644 --- a/test/SemaObjC/default-synthesize.m +++ b/test/SemaObjC/default-synthesize.m @@ -103,3 +103,15 @@ @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 +