Debian Codegraph @

clang/test/SemaObjC/protocols.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-declarations -verify %s
2
3 @interface INTF1
4 @required // expected-error {{directive may only be specified in protocols only}}
5 - (int) FooBar;
6 - (int) FooBar1;
7 - (int) FooBar2;
8 @optional // expected-error {{directive may only be specified in protocols only}}
9 + (int) C;
10
11 - (int)I;
12 @end
13
14 @protocol p1,p2,p3;
15
16 @protocol p1;
17
18 @protocol PROTO1
19 @required
20 - (int) FooBar;
21 @optional
22 - (void) MyMethod1;
23 + (int) S;
24 @end
25
26
27 @protocol PROTO2<p1>
28 @end
29
30 @protocol p1 @end
31
32 @protocol PROTO<p1> // expected-note {{previous definition is here}}
33 @end
34
35 @protocol PROTO<p1> // expected-warning {{duplicate protocol definition of 'PROTO'}}
36 @end
37
38 @protocol PROTO3<p1, p1>
39 @end
40
41 @protocol p2 <p1>
42 @end
43
44 @protocol PROTO4 <p1, p2, PROTO, PROTO3, p3>
45 @end
46
47 @protocol XX;
48 @protocol YY <XX> // Use of declaration of XX here should not cause a warning.
49 - zz;
50 @end
51
52
53 // Detect circular dependencies.
54 @protocol B;
55 @protocol C < B > // expected-note{{previous definition is here}}
56 @end
57 @protocol A < C >
58 @end
59 @protocol B < A > // expected-error{{protocol has circular dependency}}
60 @end
61
62 @protocol P
63 - (int)test:(int)param, ..; // expected-error{{type specifier missing}} \
64 // expected-error{{expected ';' after method prototype}}
65 @end