r216769 - Objective-C [qoi]. If property is going to be implemented
Fariborz Jahanian
fjahanian at apple.com
Fri Aug 29 13:29:31 PDT 2014
Author: fjahanian
Date: Fri Aug 29 15:29:31 2014
New Revision: 216769
URL: http://llvm.org/viewvc/llvm-project?rev=216769&view=rev
Log:
Objective-C [qoi]. If property is going to be implemented
in the super class, do not issue the warning about property
in current class's protocol will not be auto synthesized.
// rdar://18179833
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/Analysis/objc_invalidation.m
cfe/trunk/test/SemaObjC/default-synthesize.m
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=216769&r1=216768&r2=216769&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Aug 29 15:29:31 2014
@@ -1555,12 +1555,14 @@ void Sema::DefaultSynthesizeProperties(S
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(S
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) &&
Modified: cfe/trunk/test/Analysis/objc_invalidation.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/objc_invalidation.m?rev=216769&r1=216768&r2=216769&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/objc_invalidation.m (original)
+++ cfe/trunk/test/Analysis/objc_invalidation.m Fri Aug 29 15:29:31 2014
@@ -199,7 +199,7 @@ extern void NSLog(NSString *format, ...)
// synthesized in the parent, let the parent invalidate it.
@protocol IDEBuildable <NSObject>
- at property (readonly, strong) id <Invalidation2> ObjB; // expected-note {{property declared here}}
+ at property (readonly, strong) id <Invalidation2> ObjB;
@end
@interface Parent : NSObject <IDEBuildable, Invalidation2> {
@@ -231,7 +231,7 @@ extern void NSLog(NSString *format, ...)
}
@end
- at implementation Child // expected-warning {{auto property synthesis will not synthesize property 'ObjB' declared in protocol 'IDEBuildable'}}
+ at implementation Child
- (void)invalidate{
// no-warning
}
Modified: cfe/trunk/test/SemaObjC/default-synthesize.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize.m?rev=216769&r1=216768&r2=216769&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize.m Fri Aug 29 15:29:31 2014
@@ -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
- at implementation SubClass @end // expected-warning {{auto property synthesis will not synthesize property 'myString' declared in protocol 'TopProtocol'}}
+ at implementation SubClass @end
// rdar://7920807
@interface C @end
@@ -160,3 +160,17 @@
@implementation TimeZoneManager
@end
+
+// rdar://18179833
+ at protocol BaseProt
+ at property (assign) id prot;
+ at end
+
+ at interface Base<BaseProt>
+ at end
+
+ at interface I : Base<BaseProt>
+ at end
+
+ at implementation I
+ at end
More information about the cfe-commits
mailing list