Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fnext-runtime -emit-llvm -o %t %s |
Fariborz Jahanian | 9fed516 | 2008-12-15 20:39:58 +0000 | [diff] [blame] | 2 | |
3 | @interface Object | ||||
4 | - (id) alloc; | ||||
5 | - (id) init; | ||||
6 | @end | ||||
7 | |||||
8 | extern void abort(void); | ||||
9 | |||||
10 | #define CHECK_IF(expr) if(!(expr)) abort(); | ||||
11 | |||||
12 | @interface Base: Object | ||||
13 | { | ||||
14 | int full; | ||||
15 | int full2: 32; | ||||
16 | int _refs: 8; | ||||
17 | int field2: 3; | ||||
18 | unsigned f3: 8; | ||||
19 | short cc; | ||||
20 | unsigned g: 16; | ||||
21 | int r2: 8; | ||||
22 | int r3: 8; | ||||
23 | int r4: 2; | ||||
24 | int r5: 8; | ||||
25 | char c; | ||||
26 | } | ||||
27 | - (void)setValues; | ||||
28 | @end | ||||
29 | |||||
30 | @interface Derived: Base | ||||
31 | { | ||||
32 | char d; | ||||
33 | int _field3: 6; | ||||
34 | } | ||||
35 | - (void)checkValues; | ||||
36 | @end | ||||
37 | |||||
38 | @implementation Base | ||||
39 | -(void)setValues { | ||||
40 | full = 1; | ||||
41 | full2 = 2; | ||||
42 | _refs = 3; | ||||
43 | field2 = 1; | ||||
44 | f3 = 6; | ||||
45 | cc = 7; | ||||
46 | g = 8; | ||||
47 | r2 = 9; | ||||
48 | r3 = 10; | ||||
49 | r4 = 1; | ||||
50 | r5 = 12; | ||||
51 | c = 13; | ||||
52 | } | ||||
53 | @end | ||||
54 | |||||
55 | @implementation Derived | ||||
56 | -(void)checkValues { | ||||
57 | CHECK_IF(full == 1); | ||||
58 | CHECK_IF(full2 == 2); | ||||
59 | CHECK_IF(_refs == 3); | ||||
60 | CHECK_IF(field2 == 1); | ||||
61 | CHECK_IF(f3 == 6); | ||||
62 | CHECK_IF(cc == 7); | ||||
63 | CHECK_IF(g == 8); | ||||
64 | CHECK_IF(r2 == 9); | ||||
65 | CHECK_IF(r3 == 10); | ||||
66 | CHECK_IF(r4 == 1); | ||||
67 | CHECK_IF(r5 == 12); | ||||
68 | CHECK_IF(c == 13); | ||||
69 | } | ||||
70 | @end | ||||
71 | |||||
72 | int main(void) { | ||||
73 | Derived *obj = [[Derived alloc] init]; | ||||
74 | |||||
75 | [obj setValues]; | ||||
76 | [obj checkValues]; | ||||
77 | |||||
78 | return 0; | ||||
79 | } |