diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 7f555857c848..84752d99bd8d 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -1655,6 +1655,19 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl, for (unsigned i = 0, e = PropertyOrder.size(); i != e; i++) { ObjCPropertyDecl *Prop = PropertyOrder[i]; + // Is there a matching property synthesize/dynamic? + if (Prop->isInvalidDecl() || + Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional) + continue; + // Property may have been synthesized by user. + if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier())) + continue; + if (IMPDecl->getInstanceMethod(Prop->getGetterName())) { + if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly) + continue; + if (IMPDecl->getInstanceMethod(Prop->getSetterName())) + continue; + } // If property to be implemented in the super class, ignore. if (SuperPropMap[Prop->getIdentifier()]) { ObjCPropertyDecl *PropInSuperClass = SuperPropMap[Prop->getIdentifier()]; @@ -1669,19 +1682,6 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl, } continue; } - // Is there a matching property synthesize/dynamic? - if (Prop->isInvalidDecl() || - Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional) - continue; - // Property may have been synthesized by user. - if (IMPDecl->FindPropertyImplDecl(Prop->getIdentifier())) - continue; - if (IMPDecl->getInstanceMethod(Prop->getGetterName())) { - if (Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readonly) - continue; - if (IMPDecl->getInstanceMethod(Prop->getSetterName())) - continue; - } if (ObjCPropertyImplDecl *PID = IMPDecl->FindPropertyImplIvarDecl(Prop->getIdentifier())) { if (PID->getPropertyDecl() != Prop) { diff --git a/clang/test/SemaObjC/default-synthesize-3.m b/clang/test/SemaObjC/default-synthesize-3.m index 9977239b38fd..ce8015479ee7 100644 --- a/clang/test/SemaObjC/default-synthesize-3.m +++ b/clang/test/SemaObjC/default-synthesize-3.m @@ -129,3 +129,28 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ @synthesize six; @end +// rdar://14094682 +// no warning in this test +@interface ISAChallenge : NSObject { +} + +@property (assign, readonly) int failureCount; +@end + +@interface ISSAChallenge : ISAChallenge { + int _failureCount; +} +@property (assign, readwrite) int failureCount; +@end + +@implementation ISAChallenge +- (int)failureCount { + return 0; +} +@end + +@implementation ISSAChallenge + +@synthesize failureCount = _failureCount; +@end +