summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp7
-rw-r--r--clang/test/Analysis/objc_invalidation.m4
-rw-r--r--clang/test/SemaObjC/default-synthesize.m18
3 files changed, 22 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index ba698c1b3c3..cf9010f7fe0 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -1555,12 +1555,14 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
Diag(PID->getLocation(), diag::note_property_synthesize);
continue;
}
+ ObjCPropertyDecl *PropInSuperClass = SuperPropMap[Prop->getIdentifier()];
if (ObjCProtocolDecl *Proto =
dyn_cast<ObjCProtocolDecl>(Prop->getDeclContext())) {
// We won't auto-synthesize properties declared in protocols.
// Suppress the warning if class's superclass implements property's
// getter and implements property's setter (if readwrite property).
- if (!SuperClassImplementsProperty(IDecl, Prop)) {
+ // Or, if property is going to be implemented in its super class.
+ if (!SuperClassImplementsProperty(IDecl, Prop) && !PropInSuperClass) {
Diag(IMPDecl->getLocation(),
diag::warn_auto_synthesizing_protocol_property)
<< Prop << Proto;
@@ -1569,8 +1571,7 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl* IMPDecl,
continue;
}
// If property to be implemented in the super class, ignore.
- if (ObjCPropertyDecl *PropInSuperClass =
- SuperPropMap[Prop->getIdentifier()]) {
+ if (PropInSuperClass) {
if ((Prop->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_readwrite) &&
(PropInSuperClass->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_readonly) &&
diff --git a/clang/test/Analysis/objc_invalidation.m b/clang/test/Analysis/objc_invalidation.m
index 0d97b2952de..cd66444f401 100644
--- a/clang/test/Analysis/objc_invalidation.m
+++ b/clang/test/Analysis/objc_invalidation.m
@@ -199,7 +199,7 @@ extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1,
// synthesized in the parent, let the parent invalidate it.
@protocol IDEBuildable <NSObject>
-@property (readonly, strong) id <Invalidation2> ObjB; // expected-note {{property declared here}}
+@property (readonly, strong) id <Invalidation2> ObjB;
@end
@interface Parent : NSObject <IDEBuildable, Invalidation2> {
@@ -231,7 +231,7 @@ extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1,
}
@end
-@implementation Child // expected-warning {{auto property synthesis will not synthesize property 'ObjB' declared in protocol 'IDEBuildable'}}
+@implementation Child
- (void)invalidate{
// no-warning
}
diff --git a/clang/test/SemaObjC/default-synthesize.m b/clang/test/SemaObjC/default-synthesize.m
index d0d3085ba70..3f0ae0261da 100644
--- a/clang/test/SemaObjC/default-synthesize.m
+++ b/clang/test/SemaObjC/default-synthesize.m
@@ -88,7 +88,7 @@
@end
@protocol TopProtocol
- @property (readonly) id myString; // expected-note {{property declared here}}
+ @property (readonly) id myString;
@end
@interface TopClass <TopProtocol>
@@ -100,7 +100,7 @@
@interface SubClass : TopClass <TopProtocol>
@end
-@implementation SubClass @end // expected-warning {{auto property synthesis will not synthesize property 'myString' declared in protocol 'TopProtocol'}}
+@implementation SubClass @end
// rdar://7920807
@interface C @end
@@ -160,3 +160,17 @@
@implementation TimeZoneManager
@end
+
+// rdar://18179833
+@protocol BaseProt
+@property (assign) id prot;
+@end
+
+@interface Base<BaseProt>
+@end
+
+@interface I : Base<BaseProt>
+@end
+
+@implementation I
+@end
OpenPOWER on IntegriCloud