diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2012-06-23 18:39:57 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-06-23 18:39:57 +0000 |
| commit | a245f192c6d852b646d4f8fb3de7989db5e84806 (patch) | |
| tree | 1e357be96b7638a0970a9f043b4b6a888cb5dcb8 /clang/test/SemaObjC/warn-protocol-method-deprecated.m | |
| parent | 875f99a6bfaef47ed2f75acc5bb8014f620a9c86 (diff) | |
| download | bcm5719-llvm-a245f192c6d852b646d4f8fb3de7989db5e84806.tar.gz bcm5719-llvm-a245f192c6d852b646d4f8fb3de7989db5e84806.zip | |
objective-c: issue deprecation/unavailability warnings for methods called on
id <Protocol>. // rdar://11618852
llvm-svn: 159084
Diffstat (limited to 'clang/test/SemaObjC/warn-protocol-method-deprecated.m')
| -rw-r--r-- | clang/test/SemaObjC/warn-protocol-method-deprecated.m | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/warn-protocol-method-deprecated.m b/clang/test/SemaObjC/warn-protocol-method-deprecated.m new file mode 100644 index 00000000000..928694db252 --- /dev/null +++ b/clang/test/SemaObjC/warn-protocol-method-deprecated.m @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -verify %s +// rdar://11618852 + +@protocol TestProtocol +- (void)newProtocolMethod; +- (void)deprecatedProtocolMethod __attribute__((deprecated)); // expected-note 2 {{method 'deprecatedProtocolMethod' declared here}} +@end + +@interface NSObject @end + +@interface TestClass : NSObject <TestProtocol> + +- (void)newInstanceMethod; +- (void)deprecatedInstanceMethod __attribute__((deprecated)); // expected-note {{method 'deprecatedInstanceMethod' declared here}} + +@end + +int main(int argc, const char * argv[]) +{ + + TestClass *testObj = (TestClass*)0; + [testObj newInstanceMethod]; + [testObj deprecatedInstanceMethod]; // expected-warning {{'deprecatedInstanceMethod' is deprecated}} + + [testObj newProtocolMethod]; + [testObj deprecatedProtocolMethod]; // expected-warning {{'deprecatedProtocolMethod' is deprecated}} + + id <TestProtocol> testProto = testObj; + [testProto newProtocolMethod]; + [testProto deprecatedProtocolMethod]; // expected-warning {{'deprecatedProtocolMethod' is deprecated}} + return 0; +} |

