diff options
| author | Jordan Rose <jordan_rose@apple.com> | 2012-10-10 16:42:54 +0000 |
|---|---|---|
| committer | Jordan Rose <jordan_rose@apple.com> | 2012-10-10 16:42:54 +0000 |
| commit | 2bd991a1c09a94c76c8e38fa32e57ad7a9b111c8 (patch) | |
| tree | 4ac737822599b8e33a436d0b69841dd8ddbf2448 /clang/test | |
| parent | 79af985badfd591841abe0be09c02ffb683e1df0 (diff) | |
| download | bcm5719-llvm-2bd991a1c09a94c76c8e38fa32e57ad7a9b111c8.tar.gz bcm5719-llvm-2bd991a1c09a94c76c8e38fa32e57ad7a9b111c8.zip | |
Move Sema::PropertyIfSetterOrGetter to ObjCMethodDecl::findPropertyDecl.
Then, switch users of PropertyIfSetterOrGetter and LookupPropertyDecl
(the latter by name) over to findPropertyDecl. This actually makes
-Wreceiver-is-weak a bit stronger than it was before.
llvm-svn: 165628
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/SemaObjC/property-deprecated-warning.m | 14 | ||||
| -rw-r--r-- | clang/test/SemaObjC/weak-receiver-warn.m | 22 |
2 files changed, 34 insertions, 2 deletions
diff --git a/clang/test/SemaObjC/property-deprecated-warning.m b/clang/test/SemaObjC/property-deprecated-warning.m index 3e6ffe06722..aa7b764fab1 100644 --- a/clang/test/SemaObjC/property-deprecated-warning.m +++ b/clang/test/SemaObjC/property-deprecated-warning.m @@ -5,7 +5,7 @@ typedef signed char BOOL; @protocol P -@property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note {{property 'ptarget' is declared deprecated here}} +@property(nonatomic,assign) id ptarget __attribute__((availability(ios,introduced=2.0,deprecated=3.0))); // expected-note 2 {{property 'ptarget' is declared deprecated here}} @end @protocol P1<P> @@ -50,3 +50,15 @@ void testCustomAccessorNames(CustomAccessorNames *obj) { if ([obj isEnabled]) // expected-warning {{'isEnabled' is deprecated: first deprecated in iOS 3.0}} [obj setNewDelegate:0]; // expected-warning {{'setNewDelegate:' is deprecated: first deprecated in iOS 3.0}} } + + +@interface ProtocolInCategory +@end + +@interface ProtocolInCategory (TheCategory) <P1> +- (id)ptarget; // expected-note {{method 'ptarget' declared here}} +@end + +id useDeprecatedProperty(ProtocolInCategory *obj) { + return [obj ptarget]; // expected-warning {{'ptarget' is deprecated: first deprecated in iOS 3.0}} +} diff --git a/clang/test/SemaObjC/weak-receiver-warn.m b/clang/test/SemaObjC/weak-receiver-warn.m index 2a109dde5ee..88b867ed0d0 100644 --- a/clang/test/SemaObjC/weak-receiver-warn.m +++ b/clang/test/SemaObjC/weak-receiver-warn.m @@ -52,7 +52,7 @@ void test0(Test0 *x) { @interface MyClass { __weak MyClass *_parent; } -@property (weak) MyClass *parent; // expected-note 2 {{property declared here}} +@property (weak) MyClass *parent; // expected-note 4 {{property declared here}} @end @implementation MyClass @@ -78,3 +78,23 @@ void testProtocol(id <MyProtocol> input) { [input.object Meth]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} } + +@interface Subclass : MyClass +// Unnecessarily redeclare -parent. +- (id)parent; +@end + +@implementation Subclass + +- (id)parent { + return [super parent]; +} + +- (void)doSomethingElse { + [[self parent] doSomething]; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} + + (void)self.parent.doSomething; // expected-warning {{weak property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} +} + +@end + |

