Daniel Dunbar | 5a5a803 | 2009-05-03 21:05:10 +0000 | [diff] [blame] | 1 | // RUNX: llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o %t %s && |
| 2 | // RUN: clang-cc -triple x86_64-apple-darwin9 -fobjc-gc -emit-llvm -o %t %s && |
| 3 | // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"A\\00"' %t && |
| 4 | // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t && |
| 5 | // RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t && |
| 6 | // RUN: true |
| 7 | |
| 8 | /* |
| 9 | |
| 10 | Here is a handy command for looking at llvm-gcc's output: |
| 11 | llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o - ivar-layout-64.m | \ |
| 12 | grep 'OBJC_CLASS_NAME.* =.*global' | \ |
| 13 | sed -e 's#, section.*# ...#' | \ |
Daniel Dunbar | 3715328 | 2009-05-04 04:10:48 +0000 | [diff] [blame^] | 14 | sed -e 's#_[0-9]*"#_NNN#' | \ |
Daniel Dunbar | 5a5a803 | 2009-05-03 21:05:10 +0000 | [diff] [blame] | 15 | sort |
| 16 | |
| 17 | */ |
| 18 | |
| 19 | @interface B @end |
| 20 | |
| 21 | @interface A { |
| 22 | struct s0 { |
| 23 | int f0; |
| 24 | int f1; |
| 25 | } f0; |
| 26 | id f1; |
| 27 | __weak B *f2; |
| 28 | int f3 : 5; |
| 29 | struct s1 { |
| 30 | int *f0; |
| 31 | int *f1; |
| 32 | } f4[2][1]; |
| 33 | } |
| 34 | @end |
| 35 | |
Daniel Dunbar | 3715328 | 2009-05-04 04:10:48 +0000 | [diff] [blame^] | 36 | @interface C : A |
| 37 | @property int p3; |
| 38 | @end |
| 39 | |
| 40 | @implementation C |
| 41 | @synthesize p3 = _p3; |
| 42 | @end |
| 43 | |
Daniel Dunbar | 5a5a803 | 2009-05-03 21:05:10 +0000 | [diff] [blame] | 44 | @interface A() |
| 45 | @property int p0; |
| 46 | @property (assign) __strong id p1; |
| 47 | @property (assign) __weak id p2; |
| 48 | @end |
| 49 | |
Daniel Dunbar | 3715328 | 2009-05-04 04:10:48 +0000 | [diff] [blame^] | 50 | // FIXME: Check layout for this class, once it is clear what the right |
| 51 | // answer is. |
Daniel Dunbar | 5a5a803 | 2009-05-03 21:05:10 +0000 | [diff] [blame] | 52 | @implementation A |
Daniel Dunbar | 3715328 | 2009-05-04 04:10:48 +0000 | [diff] [blame^] | 53 | @synthesize p0 = _p0; |
| 54 | @synthesize p1 = _p1; |
| 55 | @synthesize p2 = _p2; |
| 56 | @end |
| 57 | |
| 58 | @interface D : A |
| 59 | @property int p3; |
| 60 | @end |
| 61 | |
| 62 | // FIXME: Check layout for this class, once it is clear what the right |
| 63 | // answer is. |
| 64 | @implementation D |
| 65 | @synthesize p3 = _p3; |
Daniel Dunbar | 5a5a803 | 2009-05-03 21:05:10 +0000 | [diff] [blame] | 66 | @end |