diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2014-08-29 18:31:16 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2014-08-29 18:31:16 +0000 |
| commit | c9b771560ab39146d15d6da4ea151eeb3f1f5e87 (patch) | |
| tree | f94ec90199349d5fe027bf57c7b9744ac6df68d6 /clang/test | |
| parent | 8d05190e1d2c858f29ed143346871e0217ddd950 (diff) | |
| download | bcm5719-llvm-c9b771560ab39146d15d6da4ea151eeb3f1f5e87.tar.gz bcm5719-llvm-c9b771560ab39146d15d6da4ea151eeb3f1f5e87.zip | |
Objective-C. Tweak diagnosing properties that are not auto-synthesized.
Do not warn when property declared in class's protocol will be auto-synthesized
by its uper class implementation because super class has also declared this
property while this class has not. Continue to warn if current class
has declared the property also (because this declaration will not result
in a 2nd synthesis).
rdar://18152478
llvm-svn: 216753
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Analysis/objc_invalidation.m | 4 | ||||
| -rw-r--r-- | clang/test/SemaObjC/attr-deprecated.m | 2 | ||||
| -rw-r--r-- | clang/test/SemaObjC/default-synthesize-1.m | 2 | ||||
| -rw-r--r-- | clang/test/SemaObjC/default-synthesize.m | 26 | ||||
| -rw-r--r-- | clang/test/SemaObjC/protocols-suppress-conformance.m | 10 | ||||
| -rw-r--r-- | clang/test/SemaObjC/super-property-notation.m | 2 |
6 files changed, 33 insertions, 13 deletions
diff --git a/clang/test/Analysis/objc_invalidation.m b/clang/test/Analysis/objc_invalidation.m index 9ac98284b4e..0d97b2952de 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-warning {{auto property synthesis will not synthesize property 'ObjB'}} +@property (readonly, strong) id <Invalidation2> ObjB; // expected-note {{property declared here}} @end @interface Parent : NSObject <IDEBuildable, Invalidation2> { @@ -231,7 +231,7 @@ extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, } @end -@implementation Child // expected-note {{detected while default synthesizing properties in class implementation}} +@implementation Child // expected-warning {{auto property synthesis will not synthesize property 'ObjB' declared in protocol 'IDEBuildable'}} - (void)invalidate{ // no-warning } diff --git a/clang/test/SemaObjC/attr-deprecated.m b/clang/test/SemaObjC/attr-deprecated.m index 9c33b5bade9..3e9157d0961 100644 --- a/clang/test/SemaObjC/attr-deprecated.m +++ b/clang/test/SemaObjC/attr-deprecated.m @@ -201,7 +201,7 @@ expected-note {{'setObject:' has been explicitly marked deprecated here}} @end @interface TestDerived : TestBase -@property (nonatomic, strong) id object; //expected-warning {{auto property synthesis will not synthesize property 'object' because it will be implemented by its superclass}} +@property (nonatomic, strong) id object; //expected-warning {{auto property synthesis will not synthesize property 'object'; it will be implemented by its superclass}} @end @interface TestUse @end diff --git a/clang/test/SemaObjC/default-synthesize-1.m b/clang/test/SemaObjC/default-synthesize-1.m index 3ca34e027cb..2a34a65a957 100644 --- a/clang/test/SemaObjC/default-synthesize-1.m +++ b/clang/test/SemaObjC/default-synthesize-1.m @@ -132,7 +132,7 @@ @interface ZXCalendarParsedResult : ZXParsedResult -@property (nonatomic, copy, readonly) NSString *description; // expected-warning {{auto property synthesis will not synthesize property 'description' because it will be implemented by its superclass}} +@property (nonatomic, copy, readonly) NSString *description; // expected-warning {{auto property synthesis will not synthesize property 'description'; it will be implemented by its superclass}} @end diff --git a/clang/test/SemaObjC/default-synthesize.m b/clang/test/SemaObjC/default-synthesize.m index 4865668af38..d0d3085ba70 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-warning {{auto property synthesis will not synthesize property 'myString' because it will be implemented by its superclass}} + @property (readonly) id myString; // expected-note {{property declared here}} @end @interface TopClass <TopProtocol> @@ -100,7 +100,7 @@ @interface SubClass : TopClass <TopProtocol> @end -@implementation SubClass @end // expected-note {{detected while default synthesizing properties in class implementation}} +@implementation SubClass @end // expected-warning {{auto property synthesis will not synthesize property 'myString' declared in protocol 'TopProtocol'}} // rdar://7920807 @interface C @end @@ -138,3 +138,25 @@ @implementation MyClass // expected-warning {{auto property synthesis will not synthesize property 'requiredString' declared in protocol 'MyProtocol'}} @end + +// rdar://18152478 +@protocol NSObject @end +@protocol TMSourceManagerDelegate<NSObject> +@end + +@protocol TMSourceManager <NSObject> +@property (nonatomic, assign) id <TMSourceManagerDelegate> delegate; +@end + +@interface TMSourceManager +@property (nonatomic, assign) id <TMSourceManagerDelegate> delegate; +@end + +@protocol TMTimeZoneManager <TMSourceManager> +@end + +@interface TimeZoneManager : TMSourceManager <TMTimeZoneManager> +@end + +@implementation TimeZoneManager +@end diff --git a/clang/test/SemaObjC/protocols-suppress-conformance.m b/clang/test/SemaObjC/protocols-suppress-conformance.m index 855d2e96ef6..8415154ab1d 100644 --- a/clang/test/SemaObjC/protocols-suppress-conformance.m +++ b/clang/test/SemaObjC/protocols-suppress-conformance.m @@ -5,8 +5,7 @@ __attribute__((objc_protocol_requires_explicit_implementation)) @protocol Protocol - (void) theBestOfTimes; // expected-note {{method 'theBestOfTimes' declared here}} -@property (readonly) id theWorstOfTimes; // expected-note {{property declared here}} \ - // expected-warning 2 {{auto property synthesis will not synthesize property 'theWorstOfTimes'}} +@property (readonly) id theWorstOfTimes; // expected-note {{property declared here}} @end // In this example, ClassA adopts the protocol. We won't @@ -21,8 +20,7 @@ __attribute__((objc_protocol_requires_explicit_implementation)) @interface ClassB : ClassA <Protocol> @end -@implementation ClassB // expected-warning {{property 'theWorstOfTimes' requires method 'theWorstOfTimes' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation}} \ - // expected-note {{detected while default synthesizing properties in class implementation}} +@implementation ClassB // expected-warning {{property 'theWorstOfTimes' requires method 'theWorstOfTimes' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation}} @end @interface ClassB_Good : ClassA <Protocol> @@ -34,7 +32,7 @@ __attribute__((objc_protocol_requires_explicit_implementation)) @end @interface ClassB_AlsoGood : ClassA <Protocol> -@property (readonly) id theWorstOfTimes; // expected-warning {{auto property synthesis will not synthesize property 'theWorstOfTimes' because it will be implemented by its superclass}} +@property (readonly) id theWorstOfTimes; // expected-warning {{auto property synthesis will not synthesize property 'theWorstOfTimes'; it will be implemented by its superclass}} @end // Default synthesis acts as if @dynamic @@ -42,7 +40,7 @@ __attribute__((objc_protocol_requires_explicit_implementation)) // it is declared in ClassA. This is okay, since // the author of ClassB_AlsoGood needs explicitly // write @property in the @interface. -@implementation ClassB_AlsoGood // expected-note 2 {{detected while default synthesizing properties in class implementation}} +@implementation ClassB_AlsoGood // expected-note {{detected while default synthesizing properties in class implementation}} - (void) theBestOfTimes {} @end diff --git a/clang/test/SemaObjC/super-property-notation.m b/clang/test/SemaObjC/super-property-notation.m index 7cefe09b1e7..62ff93cb2b0 100644 --- a/clang/test/SemaObjC/super-property-notation.m +++ b/clang/test/SemaObjC/super-property-notation.m @@ -41,7 +41,7 @@ __attribute__((objc_root_class)) @interface ClassBase @end @interface ClassDerived : ClassBase -@property (nonatomic, retain) ClassDerived * foo; // expected-warning {{auto property synthesis will not synthesize property 'foo' because it will be implemented by its superclass}} +@property (nonatomic, retain) ClassDerived * foo; // expected-warning {{auto property synthesis will not synthesize property 'foo'; it will be implemented by its superclass}} @end @implementation ClassDerived // expected-note {{detected while default synthesizing properties in class implementation}} |

