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