Daniel Dunbar | f643b9b | 2010-04-24 17:56:46 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-dispatch-method=mixed -emit-llvm -o %t %s |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 2 | // RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s && |
Chris Lattner | a7a98c9 | 2010-04-12 17:25:51 +0000 | [diff] [blame] | 3 | |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 4 | // RUN: grep '@"OBJC_CLASS_$_A" = global' %t |
| 5 | // RUN: grep '@"OBJC_CLASS_$_B" = external global' %t |
Bill Wendling | 1f38251 | 2011-05-04 21:37:25 +0000 | [diff] [blame] | 6 | // RUN: grep '@"OBJC_IVAR_$_A._ivar" = global .* section "__DATA, __objc_ivar", align 8' %t |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +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 |
Chris Lattner | a7a98c9 | 2010-04-12 17:25:51 +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 | af19ac4 | 2011-03-25 20:09:09 +0000 | [diff] [blame] | 10 | // RUN: grep '@"\\01L_OBJC_CLASS_NAME_[0-9]*" = internal global .* section "__TEXT,__objc_classname,cstring_literals", align 1' %t |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 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 |
Daniel Dunbar | af19ac4 | 2011-03-25 20:09:09 +0000 | [diff] [blame] | 13 | // RUN: grep '@"\\01L_OBJC_METH_VAR_NAME_[0-9]*" = internal global .* section "__TEXT,__objc_methname,cstring_literals", align 1' %t |
| 14 | // RUN: grep '@"\\01L_OBJC_METH_VAR_TYPE_[0-9]*" = internal global .* section "__TEXT,__objc_methtype,cstring_literals", align 1' %t |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 15 | // RUN: grep '@"\\01L_OBJC_PROP_NAME_ATTR_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t |
| 16 | // RUN: grep '@"\\01L_OBJC_SELECTOR_REFERENCES_*" = internal global .* section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"' %t |
| 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 |
| 31 | // RUN: grep '@"\\01l_objc_msgSend_fixup_alloc" = weak hidden global .* section "__DATA, __objc_msgrefs, coalesced", align 16' %t |
| 32 | // RUN: grep '@_objc_empty_cache = external global' %t |
| 33 | // RUN: grep '@_objc_empty_vtable = external global' %t |
| 34 | // RUN: grep '@objc_msgSend_fixup(' %t |
| 35 | // RUN: grep '@objc_msgSend_fpret(' %t |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 36 | |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 37 | |
| 38 | /* |
| 39 | |
| 40 | Here is a handy command for looking at llvm-gcc's output: |
| 41 | llvm-gcc -m64 -emit-llvm -S -o - metadata-symbols-64.m | \ |
| 42 | grep '=.*global' | \ |
| 43 | sed -e 's#global.*, section#global ... section#' | \ |
| 44 | sort |
| 45 | |
| 46 | */ |
| 47 | |
| 48 | @interface B |
| 49 | @end |
| 50 | @interface C |
| 51 | @end |
| 52 | |
| 53 | @protocol P |
| 54 | +(void) fm0; |
| 55 | -(void) im0; |
| 56 | @end |
| 57 | |
| 58 | @interface A<P> { |
| 59 | int _ivar; |
| 60 | } |
| 61 | |
| 62 | @property (assign) int ivar; |
| 63 | |
| 64 | +(void) fm0; |
| 65 | -(void) im0; |
| 66 | @end |
| 67 | |
| 68 | @implementation A |
| 69 | @synthesize ivar = _ivar; |
| 70 | +(void) fm0 { |
| 71 | } |
| 72 | -(void) im0 { |
| 73 | } |
| 74 | @end |
| 75 | |
| 76 | @implementation A (Cat) |
| 77 | +(void) fm1 { |
| 78 | } |
| 79 | -(void) im1 { |
| 80 | } |
| 81 | @end |
| 82 | |
Daniel Dunbar | 33af70f | 2009-04-15 19:03:14 +0000 | [diff] [blame] | 83 | @interface D : A |
| 84 | @end |
| 85 | |
| 86 | @implementation D |
| 87 | +(void) fm2 { |
| 88 | [super fm1]; |
| 89 | } |
| 90 | -(void) im2 { |
| 91 | [super im1]; |
| 92 | } |
| 93 | @end |
| 94 | |
Fariborz Jahanian | 5b2bad0 | 2009-04-30 16:31:11 +0000 | [diff] [blame] | 95 | // Test for FP dispatch method APIs |
| 96 | @interface Example |
| 97 | @end |
| 98 | |
| 99 | float FLOAT; |
| 100 | double DOUBLE; |
| 101 | long double LONGDOUBLE; |
| 102 | id ID; |
| 103 | |
| 104 | @implementation Example |
| 105 | - (double) RET_DOUBLE |
| 106 | { |
| 107 | return DOUBLE; |
| 108 | } |
| 109 | - (float) RET_FLOAT |
| 110 | { |
| 111 | return FLOAT; |
| 112 | } |
| 113 | - (long double) RET_LONGDOUBLE |
| 114 | { |
| 115 | return LONGDOUBLE; |
| 116 | } |
| 117 | @end |
| 118 | |
Daniel Dunbar | 33af70f | 2009-04-15 19:03:14 +0000 | [diff] [blame] | 119 | void *f0(id x) { |
Fariborz Jahanian | 5b2bad0 | 2009-04-30 16:31:11 +0000 | [diff] [blame] | 120 | Example* pe; |
| 121 | double dd = [pe RET_DOUBLE]; |
| 122 | dd = [pe RET_FLOAT]; |
| 123 | dd = [pe RET_LONGDOUBLE]; |
| 124 | |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 125 | [B im0]; |
| 126 | [C im1]; |
Daniel Dunbar | 33af70f | 2009-04-15 19:03:14 +0000 | [diff] [blame] | 127 | [D alloc]; |
Daniel Dunbar | 0bf2199 | 2009-04-15 02:56:18 +0000 | [diff] [blame] | 128 | } |
| 129 | |