xref: /minix3/external/bsd/llvm/dist/clang/test/SemaObjC/deprecate_function_containers.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1  -fsyntax-only -fblocks -verify -Wno-objc-root-class %s
2*0a6a1f1dSLionel Sambuc// rdar://10414277
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambuc@protocol P
5*0a6a1f1dSLionel Sambucvoid p_foo() {} // expected-warning {{function definition inside an Objective-C container is deprecated}}
6*0a6a1f1dSLionel Sambuc@end
7*0a6a1f1dSLionel Sambuc
8*0a6a1f1dSLionel Sambuc@interface I
9*0a6a1f1dSLionel Sambucvoid foo() {} // expected-warning {{function definition inside an Objective-C container is deprecated}}
10*0a6a1f1dSLionel Sambucinline void v_foo() {} // expected-warning {{function definition inside an Objective-C container is deprecated}}
11*0a6a1f1dSLionel Sambucstatic int s_foo() {return 0; } // expected-warning {{function definition inside an Objective-C container is deprecated}}
12*0a6a1f1dSLionel Sambucstatic inline int si_val() { return 1; } // expected-warning {{function definition inside an Objective-C container is deprecated}}
13*0a6a1f1dSLionel Sambuc@end
14*0a6a1f1dSLionel Sambuc
15*0a6a1f1dSLionel Sambuc@interface I(CAT)
16*0a6a1f1dSLionel Sambucvoid cat_foo() {} // expected-warning {{function definition inside an Objective-C container is deprecated}}
17*0a6a1f1dSLionel Sambuc@end
18*0a6a1f1dSLionel Sambuc
19*0a6a1f1dSLionel Sambuc@implementation I
20*0a6a1f1dSLionel Sambucinline void v_imp_foo() {}
21*0a6a1f1dSLionel Sambuc@end
22*0a6a1f1dSLionel Sambuc
23*0a6a1f1dSLionel Sambuc@implementation I(CAT)
24*0a6a1f1dSLionel Sambucvoid cat_imp_foo() {}
25*0a6a1f1dSLionel Sambuc@end
26*0a6a1f1dSLionel Sambuc
27*0a6a1f1dSLionel Sambuc// rdar://16859666
28*0a6a1f1dSLionel Sambuc@interface PrototypeState
29*0a6a1f1dSLionel Sambuc
30*0a6a1f1dSLionel Sambuc@property (strong, readwrite) id moin1; // expected-note {{property declared here}}
31*0a6a1f1dSLionel Sambuc
32*0a6a1f1dSLionel Sambucstatic inline void prototype_observe_moin1(void (^callback)(id)) { // expected-warning {{function definition inside an Objective-C container is deprecated}}
33*0a6a1f1dSLionel Sambuc        (void)^(PrototypeState *prototypeState){
34*0a6a1f1dSLionel Sambuc            callback(prototypeState.moin1); // expected-error {{use of Objective-C property in function nested in Objective-C container not supported, move function outside its container}}
35*0a6a1f1dSLionel Sambuc        };
36*0a6a1f1dSLionel Sambuc}
37*0a6a1f1dSLionel Sambuc@end
38