diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-11-20 17:24:03 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-11-20 17:24:03 +0000 |
commit | cb42dbe7ad2cd1a9376c25cbd744f7c12f4f46a6 (patch) | |
tree | 539a1fb1214038a8428205dda7617d8ff571fe30 /clang/test | |
parent | 3cfa97397810aa4d7d25030ff29bf9e9f15dcff3 (diff) | |
download | bcm5719-llvm-cb42dbe7ad2cd1a9376c25cbd744f7c12f4f46a6.tar.gz bcm5719-llvm-cb42dbe7ad2cd1a9376c25cbd744f7c12f4f46a6.zip |
Refine 'deprecated' checking for Objective-C classes/methods.
- If a deprecated class refers to another deprecated class, do not warn.
- @implementations of a deprecated class can refer to other deprecated things.
Fixes <rdar://problem/15407366> and <rdar://problem/15466783>.
llvm-svn: 195259
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaObjC/attr-deprecated.m | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/attr-deprecated.m b/clang/test/SemaObjC/attr-deprecated.m index aa4b479e002..cf2e063762c 100644 --- a/clang/test/SemaObjC/attr-deprecated.m +++ b/clang/test/SemaObjC/attr-deprecated.m @@ -154,3 +154,41 @@ typedef NewI DeprI __attribute__((deprecated("blah"))); // expected-note 4 {{'De return 0; } @end + +// <rdar://problem/15407366> and <rdar://problem/15466783>: +// - Using deprecated class name inside class should not warn about deprecation. +// - Implementations of deprecated classes should not result in deprecation warnings. +__attribute__((deprecated)) +@interface DeprecatedClassA +@end + +__attribute__((deprecated)) +@interface DeprecatedClassB +// The self-reference return value should not be +// flagged as the use of a deprecated declaration. ++ (DeprecatedClassB *)sharedInstance; // no-warning + +// Since this class is deprecated, returning a reference +// to another deprecated class is fine as they may +// have been deprecated together. From a user's +// perspective they are all deprecated. ++ (DeprecatedClassA *)somethingElse; // no-warning +@end + +@implementation DeprecatedClassB ++ (DeprecatedClassB *)sharedInstance +{ + // This self-reference should not + // be flagged as a use of a deprecated + // declaration. + static DeprecatedClassB *x; // no-warning + return x; +} ++ (DeprecatedClassA *)somethingElse { + // Since this class is deprecated, referencing + // another deprecated class is also OK. + static DeprecatedClassA *x; // no-warning + return x; +} + +@end |