aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-03-12 22:22:38 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-03-12 22:22:38 +0000
commit1d0d2fe76496ee2f8da9f56cb7f7eb24c4ffba05 (patch)
tree2de6d71dd245949ea500d0e2e1aa24611df43232
parent054d047c0bfe83e68c922df3766cf3f2674ddaed (diff)
Objective-C: In my last path, also check
for existence of user setter before issuing the warning about non-synthesizable property. // rdar://13388503 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176906 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaObjCProperty.cpp3
-rw-r--r--test/SemaObjC/default-synthesize-3.m11
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 2195541cd7..aae8ae6e33 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -1589,7 +1589,8 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
ObjCPropertyDecl *PropInSuperClass = SuperPropMap[Prop->getIdentifier()];
if ((Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) &&
(PropInSuperClass->getPropertyAttributes() &
- ObjCPropertyDecl::OBJC_PR_readonly)) {
+ ObjCPropertyDecl::OBJC_PR_readonly) &&
+ !IMPDecl->getInstanceMethod(Prop->getSetterName())) {
Diag(Prop->getLocation(), diag::warn_no_autosynthesis_property)
<< Prop->getIdentifier()->getName();
Diag(PropInSuperClass->getLocation(), diag::note_property_declare);
diff --git a/test/SemaObjC/default-synthesize-3.m b/test/SemaObjC/default-synthesize-3.m
index 06741e119e..09de765373 100644
--- a/test/SemaObjC/default-synthesize-3.m
+++ b/test/SemaObjC/default-synthesize-3.m
@@ -44,6 +44,7 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
@interface NSObject @end
@protocol Foo
@property (readonly) char isFoo; // expected-note {{property declared here}}
+@property (readonly) char isNotFree;
@end
@interface Bar : NSObject <Foo>
@@ -53,6 +54,9 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
- (char)isFoo {
return 0;
}
+- (char)isNotFree {
+ return 0;
+}
@end
@interface Baz : Bar
@@ -62,10 +66,17 @@ __attribute ((objc_requires_property_definitions)) // expected-error {{objc_requ
@property (readwrite) char isFoo; // expected-warning {{auto property synthesis will not synthesize property 'isFoo' because it is 'readwrite' but it will be synthesized 'readonly' via another property}}
@property char Property1; // expected-warning {{auto property synthesis will not synthesize property 'Property1' because it cannot share an ivar with another synthesized property}}
@property char Property2;
+@property (readwrite) char isNotFree;
@end
@implementation Baz {
char _isFoo;
+ char _isNotFree;
}
@synthesize Property2 = Property1; // expected-note {{property synthesized here}}
+
+- (void) setIsNotFree : (char)Arg {
+ _isNotFree = Arg;
+}
+
@end