blob: a7bcf01926b2d27c2eef6db76f400b2b6a957d14 [file] [log] [blame]
John McCalld1e40d52011-10-02 01:16:38 +00001// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-fragile-abi -emit-llvm -o %t %s
Daniel Dunbar0bf21992009-04-15 02:56:18 +00002// RUNX: llvm-gcc -m32 -emit-llvm -S -o %t %s &&
3
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00004// RUN: grep '@"\\01L_OBJC_CATEGORY_A_Cat" = internal global .*section "__OBJC,__category,regular,no_dead_strip", align 4' %t
5// RUN: grep '@"\\01L_OBJC_CATEGORY_CLASS_METHODS_A_Cat" = internal global .*section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4' %t
6// RUN: grep '@"\\01L_OBJC_CATEGORY_INSTANCE_METHODS_A_Cat" = internal global .*section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4' %t
7// RUN: grep '@"\\01L_OBJC_CLASSEXT_A" = internal global .*section "__OBJC,__class_ext,regular,no_dead_strip", align 4' %t
8// RUN: grep '@"\\01L_OBJC_CLASS_A" = internal global .*section "__OBJC,__class,regular,no_dead_strip", align 4' %t
9// RUN: grep '@"\\01L_OBJC_CLASS_METHODS_A" = internal global .*section "__OBJC,__cls_meth,regular,no_dead_strip", align 4' %t
Jim Grosbach38d24792010-07-19 22:53:57 +000010// RUN: grep '@"\\01L_OBJC_CLASS_NAME_[0-9]*" = internal global .*section "__TEXT,__cstring,cstring_literals", align 1' %t
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000011// RUN: grep '@"\\01L_OBJC_CLASS_PROTOCOLS_A" = internal global .*section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4' %t
12// RUN: grep '@"\\01L_OBJC_CLASS_REFERENCES_[0-9]*" = internal global .*section "__OBJC,__cls_refs,literal_pointers,no_dead_strip", align 4' %t
Daniel Dunbar0bf21992009-04-15 02:56:18 +000013
14// Clang's Obj-C 32-bit doesn't emit ivars for the root class.
15// RUNX: grep '@"\\01L_OBJC_CLASS_VARIABLES_A" = internal global .*section "__OBJC,__class_vars,regular,no_dead_strip", align 4' %t &&
16
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000017// RUN: grep '@"\\01L_OBJC_INSTANCE_METHODS_A" = internal global .*section "__OBJC,__inst_meth,regular,no_dead_strip", align 4' %t
18// RUN: grep '@"\\01L_OBJC_INSTANCE_VARIABLES_A" = internal global .*section "__OBJC,__instance_vars,regular,no_dead_strip", align 4' %t
19// RUN: grep '@"\\01L_OBJC_METACLASS_A" = internal global .*section "__OBJC,__meta_class,regular,no_dead_strip", align 4' %t
Jim Grosbach38d24792010-07-19 22:53:57 +000020// RUN: grep '@"\\01L_OBJC_METH_VAR_NAME_[0-9]*" = internal global .*section "__TEXT,__cstring,cstring_literals", align 1' %t
21// RUN: grep '@"\\01L_OBJC_METH_VAR_TYPE_[0-9]*" = internal global .*section "__TEXT,__cstring,cstring_literals", align 1' %t
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000022// RUN: grep '@"\\01L_OBJC_MODULES" = internal global .*section "__OBJC,__module_info,regular,no_dead_strip", align 4' %t
23// RUN: grep '@"\\01L_OBJC_PROP_NAME_ATTR_[0-9]*" = internal global .*section "__TEXT,__cstring,cstring_literals", align 1' %t
24// RUN: grep '@"\\01L_OBJC_PROTOCOL_CLASS_METHODS_P" = internal global .*section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4' %t
25// RUN: grep '@"\\01L_OBJC_PROTOCOL_INSTANCE_METHODS_P" = internal global .*section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4' %t
26// RUN: grep '@"\\01L_OBJC_PROTOCOL_P" = internal global .*section "__OBJC,__protocol,regular,no_dead_strip", align 4' %t
27// RUN: grep '@"\\01L_OBJC_SELECTOR_REFERENCES_[0-9]*" = internal global .*section "__OBJC,__message_refs,literal_pointers,no_dead_strip", align 4' %t
28// RUN: grep '@"\\01L_OBJC_SYMBOLS" = internal global .*section "__OBJC,__symbols,regular,no_dead_strip", align 4' %t
29// RUN: grep '@"\\01l_OBJC_$_PROP_LIST_A" = internal global .*section "__OBJC,__property,regular,no_dead_strip", align 4' %t
30// RUN: grep "\.lazy_reference \.objc_class_name_J0" %t
Daniel Dunbar0bf21992009-04-15 02:56:18 +000031
Daniel Dunbar0bf21992009-04-15 02:56:18 +000032
33/*
34
35Here is a handy command for looking at llvm-gcc's output:
36llvm-gcc -m32 -emit-llvm -S -o - metadata-symbols-32.m | \
37 grep '=.*global' | \
38 sed -e 's#global.*, section#global ... section#' | \
39 sort
40
41*/
42
43@interface B
44@end
45@interface C
46@end
47
48@protocol P
49+(void) fm0;
50-(void) im0;
51@end
52
53@interface A<P> {
54 int _ivar;
55}
56
57@property (assign) int ivar;
58
59+(void) fm0;
60-(void) im0;
61@end
62
63@implementation A
64@synthesize ivar = _ivar;
65+(void) fm0 {
66}
67-(void) im0 {
68}
69@end
70
71@implementation A (Cat)
72+(void) fm1 {
73}
74-(void) im1 {
75}
76@end
77
Fariborz Jahanian679cd7f2009-04-29 20:40:05 +000078@interface J0
79@end
80
81@implementation J0(Category) @end
82
Daniel Dunbar0bf21992009-04-15 02:56:18 +000083void *f0() {
84 [B im0];
85 [C im1];
86}
87