xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/warn-protocol-method-deprecated.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -Wno-objc-root-class -verify %s
2f4a2713aSLionel Sambuc// rdar://11618852
3f4a2713aSLionel Sambuc
4f4a2713aSLionel Sambuc@protocol TestProtocol
5f4a2713aSLionel Sambuc- (void)newProtocolMethod;
6*0a6a1f1dSLionel Sambuc- (void)deprecatedProtocolMethod __attribute__((deprecated)); // expected-note 2 {{'deprecatedProtocolMethod' has been explicitly marked deprecated here}}
7f4a2713aSLionel Sambuc@end
8f4a2713aSLionel Sambuc
9f4a2713aSLionel Sambuc@interface NSObject @end
10f4a2713aSLionel Sambuc
11f4a2713aSLionel Sambuc@interface TestClass : NSObject <TestProtocol>
12f4a2713aSLionel Sambuc
13f4a2713aSLionel Sambuc- (void)newInstanceMethod;
14*0a6a1f1dSLionel Sambuc- (void)deprecatedInstanceMethod __attribute__((deprecated)); // expected-note {{'deprecatedInstanceMethod' has been explicitly marked deprecated here}}
15f4a2713aSLionel Sambuc
16f4a2713aSLionel Sambuc@end
17f4a2713aSLionel Sambuc
18f4a2713aSLionel Sambucint main(int argc, const char * argv[])
19f4a2713aSLionel Sambuc{
20f4a2713aSLionel Sambuc
21f4a2713aSLionel Sambuc    TestClass *testObj = (TestClass*)0;
22f4a2713aSLionel Sambuc    [testObj newInstanceMethod];
23f4a2713aSLionel Sambuc    [testObj deprecatedInstanceMethod]; // expected-warning {{'deprecatedInstanceMethod' is deprecated}}
24f4a2713aSLionel Sambuc
25f4a2713aSLionel Sambuc    [testObj newProtocolMethod];
26f4a2713aSLionel Sambuc    [testObj deprecatedProtocolMethod]; // expected-warning {{'deprecatedProtocolMethod' is deprecated}}
27f4a2713aSLionel Sambuc
28f4a2713aSLionel Sambuc    id <TestProtocol> testProto = testObj;
29f4a2713aSLionel Sambuc    [testProto newProtocolMethod];
30f4a2713aSLionel Sambuc    [testProto deprecatedProtocolMethod]; // expected-warning {{'deprecatedProtocolMethod' is deprecated}}
31f4a2713aSLionel Sambuc    return 0;
32f4a2713aSLionel Sambuc}
33