Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s && |
| 2 | // RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s && |
| 3 | |
| 4 | // RUN: grep '@"OBJC_CLASS_$_A" = global' %t && |
| 5 | // RUN: grep '@"OBJC_CLASS_$_B" = external global' %t && |
Daniel Dunbar | 7595fb1 | 2009-04-15 19:52:32 +0000 | [diff] [blame] | 6 | // RUN: grep '@"OBJC_IVAR_$_A._ivar" = global .* section "__DATA, __objc_const", align 8' %t && |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 7 | // RUN: grep '@"OBJC_METACLASS_$_A" = global .* section "__DATA, __objc_data", align 8' %t && |
| 8 | // RUN: grep '@"\\01L_OBJC_CLASSLIST_REFERENCES_$_[0-9]*" = internal global .* section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8' %t && |
Daniel Dunbar | 33af70f | 2009-04-15 19:03:14 +0000 | [diff] [blame] | 9 | // RUN: grep '@"\\01L_OBJC_CLASSLIST_SUP_REFS_$_[0-9]*" = internal global .* section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8' %t | count 2 && |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 10 | // RUN: grep '@"\\01L_OBJC_CLASS_NAME_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t && |
| 11 | // RUN: grep '@"\\01L_OBJC_LABEL_CATEGORY_$" = internal global .* section "__DATA, __objc_catlist, regular, no_dead_strip", align 8' %t && |
| 12 | // RUN: grep '@"\\01L_OBJC_LABEL_CLASS_$" = internal global .* section "__DATA, __objc_classlist, regular, no_dead_strip", align 8' %t && |
| 13 | // RUN: grep '@"\\01L_OBJC_METH_VAR_NAME_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t && |
| 14 | // RUN: grep '@"\\01L_OBJC_METH_VAR_TYPE_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t && |
| 15 | // RUN: grep '@"\\01L_OBJC_PROP_NAME_ATTR_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t && |
Fariborz Jahanian | d0f8a8d | 2009-05-11 19:25:47 +0000 | [diff] [blame] | 16 | // RUN: grep '@"\\01L_OBJC_SELECTOR_REFERENCES_*" = internal global .* section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"' %t && |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 17 | // RUN: grep '@"\\01l_OBJC_$_CATEGORY_A_$_Cat" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 18 | // RUN: grep '@"\\01l_OBJC_$_CATEGORY_CLASS_METHODS_A_$_Cat" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 19 | // RUN: grep '@"\\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_A_$_Cat" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 20 | // RUN: grep '@"\\01l_OBJC_$_CLASS_METHODS_A" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 21 | // RUN: grep '@"\\01l_OBJC_$_INSTANCE_METHODS_A" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 22 | // RUN: grep '@"\\01l_OBJC_$_INSTANCE_VARIABLES_A" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 23 | // RUN: grep '@"\\01l_OBJC_$_PROP_LIST_A" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 24 | // RUN: grep '@"\\01l_OBJC_$_PROTOCOL_CLASS_METHODS_P" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 25 | // RUN: grep '@"\\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_P" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 26 | // RUN: grep '@"\\01l_OBJC_CLASS_PROTOCOLS_$_A" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 27 | // RUN: grep '@"\\01l_OBJC_CLASS_RO_$_A" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 28 | // RUN: grep '@"\\01l_OBJC_LABEL_PROTOCOL_$_P" = weak hidden global .* section "__DATA, __objc_protolist, coalesced, no_dead_strip", align 8' %t && |
| 29 | // RUN: grep '@"\\01l_OBJC_METACLASS_RO_$_A" = internal global .* section "__DATA, __objc_const", align 8' %t && |
| 30 | // RUN: grep '@"\\01l_OBJC_PROTOCOL_$_P" = weak hidden global .* section "__DATA,__datacoal_nt,coalesced", align 8' %t && |
Daniel Dunbar | f59c1a6 | 2009-04-15 19:04:46 +0000 | [diff] [blame] | 31 | // RUN: grep '@"\\01l_objc_msgSend_fixup_alloc" = weak hidden global .* section "__DATA, __objc_msgrefs, coalesced", align 16' %t && |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 32 | // RUN: grep '@_objc_empty_cache = external global' %t && |
| 33 | // RUN: grep '@_objc_empty_vtable = external global' %t && |
Fariborz Jahanian | 5b2bad0 | 2009-04-30 16:31:11 +0000 | [diff] [blame] | 34 | // RUN: grep '@objc_msgSend_fixup(' %t && |
Fariborz Jahanian | d0f8a8d | 2009-05-11 19:25:47 +0000 | [diff] [blame] | 35 | // RUN: grep '@objc_msgSend_fpret(' %t && |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 36 | |
| 37 | // RUN: true |
| 38 | |
| 39 | /* |
| 40 | |
| 41 | Here is a handy command for looking at llvm-gcc's output: |
| 42 | llvm-gcc -m64 -emit-llvm -S -o - metadata-symbols-64.m | \ |
| 43 | grep '=.*global' | \ |
| 44 | sed -e 's#global.*, section#global ... section#' | \ |
| 45 | sort |
| 46 | |
| 47 | */ |
| 48 | |
| 49 | @interface B |
| 50 | @end |
| 51 | @interface C |
| 52 | @end |
| 53 | |
| 54 | @protocol P |
| 55 | +(void) fm0; |
| 56 | -(void) im0; |
| 57 | @end |
| 58 | |
| 59 | @interface A<P> { |
| 60 | int _ivar; |
| 61 | } |
| 62 | |
| 63 | @property (assign) int ivar; |
| 64 | |
| 65 | +(void) fm0; |
| 66 | -(void) im0; |
| 67 | @end |
| 68 | |
| 69 | @implementation A |
| 70 | @synthesize ivar = _ivar; |
| 71 | +(void) fm0 { |
| 72 | } |
| 73 | -(void) im0 { |
| 74 | } |
| 75 | @end |
| 76 | |
| 77 | @implementation A (Cat) |
| 78 | +(void) fm1 { |
| 79 | } |
| 80 | -(void) im1 { |
| 81 | } |
| 82 | @end |
| 83 | |
Daniel Dunbar | 33af70f | 2009-04-15 19:03:14 +0000 | [diff] [blame] | 84 | @interface D : A |
| 85 | @end |
| 86 | |
| 87 | @implementation D |
| 88 | +(void) fm2 { |
| 89 | [super fm1]; |
| 90 | } |
| 91 | -(void) im2 { |
| 92 | [super im1]; |
| 93 | } |
| 94 | @end |
| 95 | |
Fariborz Jahanian | 5b2bad0 | 2009-04-30 16:31:11 +0000 | [diff] [blame] | 96 | // Test for FP dispatch method APIs |
| 97 | @interface Example |
| 98 | @end |
| 99 | |
| 100 | float FLOAT; |
| 101 | double DOUBLE; |
| 102 | long double LONGDOUBLE; |
| 103 | id ID; |
| 104 | |
| 105 | @implementation Example |
| 106 | - (double) RET_DOUBLE |
| 107 | { |
| 108 | return DOUBLE; |
| 109 | } |
| 110 | - (float) RET_FLOAT |
| 111 | { |
| 112 | return FLOAT; |
| 113 | } |
| 114 | - (long double) RET_LONGDOUBLE |
| 115 | { |
| 116 | return LONGDOUBLE; |
| 117 | } |
| 118 | @end |
| 119 | |
Daniel Dunbar | 33af70f | 2009-04-15 19:03:14 +0000 | [diff] [blame] | 120 | void *f0(id x) { |
Fariborz Jahanian | 5b2bad0 | 2009-04-30 16:31:11 +0000 | [diff] [blame] | 121 | Example* pe; |
| 122 | double dd = [pe RET_DOUBLE]; |
| 123 | dd = [pe RET_FLOAT]; |
| 124 | dd = [pe RET_LONGDOUBLE]; |
| 125 | |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 126 | [B im0]; |
| 127 | [C im1]; |
Daniel Dunbar | 33af70f | 2009-04-15 19:03:14 +0000 | [diff] [blame] | 128 | [D alloc]; |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 129 | } |
| 130 | |