diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2015-03-10 21:28:33 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2015-03-10 21:28:33 +0000 |
commit | 2954c67e4b539a6a93ff91c3fd7b0df60bee8a3e (patch) | |
tree | f4afb1872cd3c64247f2e87b02214f56ea546743 /clang/test/SemaObjC | |
parent | bdc6c83d24b10d350f6ce1cb408c9b1064e60508 (diff) | |
download | bcm5719-llvm-2954c67e4b539a6a93ff91c3fd7b0df60bee8a3e.tar.gz bcm5719-llvm-2954c67e4b539a6a93ff91c3fd7b0df60bee8a3e.zip |
[Objective-C Sema]. Remove -Wreceiver-is-weak warning.
It is incorrect and better warning is issued under
-Warc-repeated-use-of-weak. rdar://16316934.
llvm-svn: 231851
Diffstat (limited to 'clang/test/SemaObjC')
-rw-r--r-- | clang/test/SemaObjC/iboutlet.m | 4 | ||||
-rw-r--r-- | clang/test/SemaObjC/weak-receiver-warn.m | 100 |
2 files changed, 2 insertions, 102 deletions
diff --git a/clang/test/SemaObjC/iboutlet.m b/clang/test/SemaObjC/iboutlet.m index 7d656a51684..2ce4ce1d87a 100644 --- a/clang/test/SemaObjC/iboutlet.m +++ b/clang/test/SemaObjC/iboutlet.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Wno-objc-root-class -Wreceiver-is-weak -Warc-repeated-use-of-weak -fobjc-runtime-has-weak -verify %s -// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-arc -Wno-objc-root-class -Wreceiver-is-weak -Warc-repeated-use-of-weak -fobjc-runtime-has-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Wno-objc-root-class -Warc-repeated-use-of-weak -fobjc-runtime-has-weak -verify %s +// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -fobjc-arc -Wno-objc-root-class -Warc-repeated-use-of-weak -fobjc-runtime-has-weak -verify %s // rdar://11448209 #define READONLY readonly diff --git a/clang/test/SemaObjC/weak-receiver-warn.m b/clang/test/SemaObjC/weak-receiver-warn.m deleted file mode 100644 index 88b867ed0d0..00000000000 --- a/clang/test/SemaObjC/weak-receiver-warn.m +++ /dev/null @@ -1,100 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -Wno-objc-root-class -Wreceiver-is-weak -verify %s -// rdar://10225276 - -@interface Test0 -- (void) setBlock: (void(^)(void)) block; -- (void) addBlock: (void(^)(void)) block; -- (void) actNow; -@end - -void test0(Test0 *x) { - __weak Test0 *weakx = x; - [x addBlock: ^{ [weakx actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} - [x setBlock: ^{ [weakx actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} - x.block = ^{ [weakx actNow]; }; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} - - [weakx addBlock: ^{ [x actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} - [weakx setBlock: ^{ [x actNow]; }]; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} - weakx.block = ^{ [x actNow]; }; // expected-warning {{weak receiver may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} -} - -@interface Test -{ - __weak Test* weak_prop; -} -- (void) Meth; -@property __weak Test* weak_prop; // expected-note {{property declared here}} -@property (weak, atomic) id weak_atomic_prop; // expected-note {{property declared here}} -- (__weak id) P; // expected-note {{method 'P' declared here}} -@end - -@implementation Test -- (void) Meth { - if (self.weak_prop) { - self.weak_prop = 0; - } - if (self.weak_atomic_prop) { - self.weak_atomic_prop = 0; - } - [self.weak_prop 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}} - id pi = self.P; - - [self.weak_atomic_prop 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}} - - [self.P Meth]; // expected-warning {{weak implicit property may be unpredictably set to nil}} expected-note {{assign the value to a strong variable to keep the object alive during use}} -} - -- (__weak id) P { return 0; } -@dynamic weak_prop, weak_atomic_prop; -@end - - -@interface MyClass { - __weak MyClass *_parent; -} -@property (weak) MyClass *parent; // expected-note 4 {{property declared here}} -@end - -@implementation MyClass -@synthesize parent = _parent; - -- (void)doSomething -{ - [[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 - - -// Weak properties on protocols can be synthesized by an adopting class. -@protocol MyProtocol -@property (weak) id object; // expected-note 2 {{property declared here}} -@end - -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}} - [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 - |