Don't error when doing default property synthesis

and some are already synthesized by user declaration.

llvm-svn: 108341
This commit is contained in:
Fariborz Jahanian 2010-07-14 18:11:52 +00:00
parent 75fbb3b5e5
commit 56a9d54de8
2 changed files with 16 additions and 0 deletions

View 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());

View File

@ -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