summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjC/property-deprecated-warning.m14
-rw-r--r--clang/test/SemaObjC/weak-receiver-warn.m22
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
+
OpenPOWER on IntegriCloud