Debian Codegraph @

clang/test/SemaObjC/class-property-access.m

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
3
4 @interface Test {}
5 + (Test*)one;
6 - (int)two;
7 @end
8
9 int main (void)
10 {
11 return Test.one.two;
12 }
13
14 __attribute__((objc_root_class))
15 @interface RootClass {
16 Class isa;
17 }
18
19 @property int property;
20 -(int)method;
21 - (void) setMethod : (int)arg;
22 +(int)classMethod;
23 @end
24
25 @interface Subclass : RootClass @end
26 void Test1(void) {
27 // now okay
28 (void)RootClass.property;
29 (void)Subclass.property;
30 (void)RootClass.method;
31 (void)Subclass.method;
32
33 RootClass.property = 1;
34 Subclass.property = 2;
35 RootClass.method = 3;
36 Subclass.method = 4;
37
38 // okay
39 (void)RootClass.classMethod;
40 (void)Subclass.classMethod;
41
42 // also okay
43 (void)[RootClass property];
44 (void)[Subclass property];
45 [RootClass method];
46 [Subclass method];
47 [RootClass classMethod];
48 [Subclass classMethod];
49
50 // also okay
51 [RootClass setProperty : 1];
52 [Subclass setProperty : 2];
53 [RootClass setMethod : 3];
54 [Subclass setMethod : 4];
55 }