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

of properties. Fixes // rdar://14085456

llvm-svn: 183542
This commit is contained in:
Fariborz Jahanian 2013-06-07 18:32:55 +00:00
parent ebe0be9ca4
commit 4614524d4a
2 changed files with 28 additions and 10 deletions

View File

@ -1673,16 +1673,6 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
if (Prop->isInvalidDecl() || if (Prop->isInvalidDecl() ||
Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional) Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional)
continue; 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. // Property may have been synthesized by user.
if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier())) if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier()))
continue; continue;
@ -1692,6 +1682,16 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
if (IMPDecl->getInstanceMethod(Prop->getSetterName())) if (IMPDecl->getInstanceMethod(Prop->getSetterName()))
continue; 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())) { if (isa<ObjCProtocolDecl>(Prop->getDeclContext())) {
// We won't auto-synthesize properties declared in protocols. // We won't auto-synthesize properties declared in protocols.
Diag(IMPDecl->getLocation(), Diag(IMPDecl->getLocation(),

View File

@ -111,3 +111,21 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
@implementation S @implementation S
@end @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