1// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
2
3// CHECK: .lazy_reference .objc_class_name_J0
4
5// CHECK: @OBJC_METH_VAR_NAME_{{[0-9]*}} = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1
6// CHECK: @OBJC_METH_VAR_TYPE_{{[0-9]*}} = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1
7// CHECK: @"\01l_OBJC_PROTOCOLEXT_P" = private global
8// CHECK-NOT: section
9// CHECK: @OBJC_CLASS_NAME_{{[0-9]*}} = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1
10// CHECK: @OBJC_PROTOCOL_INSTANCE_METHODS_P = private global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4
11// CHECK: @OBJC_PROTOCOL_CLASS_METHODS_P = private global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4
12// CHECK: @OBJC_PROTOCOL_P = private global {{.*}}section "__OBJC,__protocol,regular,no_dead_strip", align 4
13// CHECK: @OBJC_CLASS_PROTOCOLS_A = private global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4
14// CHECK: @OBJC_CLASS_METHODS_A = private global {{.*}}section "__OBJC,__cls_meth,regular,no_dead_strip", align 4
15// CHECK: @OBJC_METACLASS_A = private global {{.*}}section "__OBJC,__meta_class,regular,no_dead_strip", align 4
16// CHECK: @OBJC_INSTANCE_VARIABLES_A = private global {{.*}}section "__OBJC,__instance_vars,regular,no_dead_strip", align 4
17// CHECK: @OBJC_INSTANCE_METHODS_A = private global {{.*}}section "__OBJC,__inst_meth,regular,no_dead_strip", align 4
18// CHECK: @OBJC_PROP_NAME_ATTR_{{[0-9]*}} = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1
19// CHECK: @"\01l_OBJC_$_PROP_LIST_A" = private global {{.*}}section "__OBJC,__property,regular,no_dead_strip", align 4
20// CHECK: @OBJC_CLASSEXT_A = private global {{.*}}section "__OBJC,__class_ext,regular,no_dead_strip", align 4
21// CHECK: @OBJC_CLASS_A = private global {{.*}}section "__OBJC,__class,regular,no_dead_strip", align 4
22// CHECK: @OBJC_CATEGORY_INSTANCE_METHODS_A_Cat = private global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4
23// CHECK: @OBJC_CATEGORY_CLASS_METHODS_A_Cat = private global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4
24// CHECK: @OBJC_CATEGORY_A_Cat = private global {{.*}}section "__OBJC,__category,regular,no_dead_strip", align 4
25// CHECK: @OBJC_CLASS_REFERENCES_{{[0-9]*}} = private global {{.*}}section "__OBJC,__cls_refs,literal_pointers,no_dead_strip", align 4
26// CHECK: @OBJC_SELECTOR_REFERENCES_{{[0-9]*}} = private externally_initialized global {{.*}}section "__OBJC,__message_refs,literal_pointers,no_dead_strip", align 4
27// CHECK: @OBJC_SYMBOLS = private global {{.*}}section "__OBJC,__symbols,regular,no_dead_strip", align 4
28// CHECK: @OBJC_MODULES = private global {{.*}}section "__OBJC,__module_info,regular,no_dead_strip", align 4
29
30// Clang's Obj-C 32-bit doesn't emit ivars for the root class.
31// CHECKX: @"\01L_OBJC_CLASS_VARIABLES_A" = private global {{.*}}section "__OBJC,__class_vars,regular,no_dead_strip", align 4
32
33
34/*
35
36Here is a handy command for looking at llvm-gcc's output:
37llvm-gcc -m32 -emit-llvm -S -o - metadata-symbols-32.m | \
38  grep '=.*global' | \
39  sed -e 's#global.*, section#global ... section#' | \
40  sort
41
42*/
43
44@interface B
45@end
46@interface C
47@end
48
49@protocol P
50+(void) fm0;
51-(void) im0;
52@end
53
54@interface A<P> {
55  int _ivar;
56}
57
58@property (assign) int ivar;
59
60+(void) fm0;
61-(void) im0;
62@end
63
64@implementation A
65@synthesize ivar = _ivar;
66+(void) fm0 {
67}
68-(void) im0 {
69}
70@end
71
72@implementation A (Cat)
73+(void) fm1 {
74}
75-(void) im1 {
76}
77@end
78
79@interface J0
80@end
81
82@implementation J0(Category) @end
83
84void *f0() {
85   [B im0];
86   [C im1];
87}
88
89