diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2014-11-24 09:15:30 +0000 |
commit | 9f4dbff6669c8037f3b036bcf580d14f1a4f12a5 (patch) | |
tree | 47df2c12b57214af6c31e47404b005675b8b7ffc /test/SemaObjC/unused.m | |
parent | f73d5f23a889b93d89ddef61ac0995df40286bb8 (diff) | |
download | src-9f4dbff6669c8037f3b036bcf580d14f1a4f12a5.tar.gz src-9f4dbff6669c8037f3b036bcf580d14f1a4f12a5.zip |
Vendor import of clang RELEASE_350/final tag r216957 (effectively, 3.5.0 release):vendor/clang/clang-release_350-r216957
Notes
Notes:
svn path=/vendor/clang/dist/; revision=274958
svn path=/vendor/clang/clang-release_350-r216957/; revision=274959; tag=vendor/clang/clang-release_350-r216957
Diffstat (limited to 'test/SemaObjC/unused.m')
-rw-r--r-- | test/SemaObjC/unused.m | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/SemaObjC/unused.m b/test/SemaObjC/unused.m index 3fd1cf04673f..6ea3fe8e00ab 100644 --- a/test/SemaObjC/unused.m +++ b/test/SemaObjC/unused.m @@ -72,3 +72,35 @@ static NSString *x = @"hi"; // expected-warning {{unused variable 'x'}} - (void) b {} - (void) a { [self b]; } @end + +// Test that objc_precise_lifetime suppresses +// unused variable warnings. +extern void rdar15596883_foo(void); +void rdar15596883(id x) { + __attribute__((objc_precise_lifetime)) id y = x; // no-warning + rdar15596883_foo(); +} + +@interface PropertyObject : NSObject +@property int length; +@end + +@protocol P +@property int property; +@end + +void test3(PropertyObject *o) +{ + [o length]; // expected-warning {{property access result unused - getters should not be used for side effects}} + (void)[o length]; +} + +void test4(id o) +{ + [o length]; // No warning. +} + +void test5(id <P> p) +{ + [p property]; // expected-warning {{property access result unused - getters should not be used for side effects}} +} |