1 // RUN: %clang_cc1 -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
2 // RUN: FileCheck < %t %s
4 // CHECK: @OBJC_METH_VAR_TYPE_{{.*}} = private unnamed_addr constant [16 x i8] c"v12@0:4[3[4@]]8\00"
14 struct Innermost *innermost;
23 struct objc_class *isa;
39 @interface Derived: Base
49 @implementation Derived
54 struct objc_class *isa;
66 __attribute__((objc_gc(weak))) SEL selector;
68 -(void) test3: (Test* [3] [4])b ;
69 - (SEL**) meth : (SEL) arg : (SEL*****) arg1 : (SEL*)arg2 : (SEL**) arg3;
73 -(void) test3: (Test* [3] [4])b {}
74 - (SEL**) meth : (SEL) arg : (SEL*****) arg1 : (SEL*)arg2 : (SEL**) arg3 {}
88 const char *en = @encode(Derived);
89 const char *eb = @encode(B1);
90 const char *es = @encode(const struct S *);
91 const char *ec = @encode(const struct S);
92 const char *ee = @encode(MyObj *const);
95 // CHECK: @g0 ={{.*}} constant [15 x i8] c"{Innermost=CC}\00"
96 const char g0[] = @encode(struct Innermost);
98 // CHECK: @g1 ={{.*}} constant [38 x i8] c"{Derived=#ib32b8b3b8sb16b8b8b2b8ccb6}\00"
99 const char g1[] = @encode(Derived);
101 // CHECK: @g2 ={{.*}} constant [9 x i8] c"{B1=#@c}\00"
102 const char g2[] = @encode(B1);
104 // CHECK: @g3 ={{.*}} constant [8 x i8] c"r^{S=i}\00"
105 const char g3[] = @encode(const struct S *);
107 // CHECK: @g4 ={{.*}} constant [6 x i8] c"{S=i}\00"
108 const char g4[] = @encode(const struct S);
110 // CHECK: @g5 ={{.*}} constant [2 x i8] c"@\00"
111 const char g5[] = @encode(MyObj * const);
115 enum Enum1X { one, two, three, four };
125 @interface Derived1X: Base1X {
132 @implementation Base1X @end
134 @implementation Derived1X @end
136 // CHECK: @g6 ={{.*}} constant [18 x i8] c"{Base1X=b2b3b4b5}\00"
137 const char g6[] = @encode(Base1X);
139 // CHECK: @g7 ={{.*}} constant [27 x i8] c"{Derived1X=b2b3b4b5b5b4b3}\00"
140 const char g7[] = @encode(Derived1X);
142 // CHECK: @g8 ={{.*}} constant [7 x i8] c"{s8=D}\00"
146 const char g8[] = @encode(struct s8);
148 // CHECK: @g9 ={{.*}} constant [11 x i8] c"{S9=i[0i]}\00"
153 const char g9[] = @encode(struct S9);
162 // CHECK: @g10 ={{.*}} constant [14 x i8] c"{f=i[4{?=}]i}\00"
163 const char g10[] = @encode(struct f);
165 // CHECK: @g11 ={{.*}} constant [2 x i8] c"v\00"
166 const char g11[] = @encode(void);
169 // CHECK: @g12 ={{.*}} constant [3 x i8] c"Ai\00"
170 const char g12[] = @encode(_Atomic(int));
173 Class test_class = 0;
174 const char g13[] = @encode(__typeof__(*test_class));
175 const char g14[] = @encode(__typeof__(*test_id));
176 // CHECK: constant [14 x i8] c"{objc_class=}\00"
177 // CHECK: constant [15 x i8] c"{objc_object=}\00"
179 // CHECK: @g15 ={{.*}} constant [2 x i8] c":\00"
180 const char g15[] = @encode(SEL);
182 typedef typeof(sizeof(int)) size_t;
183 size_t strlen(const char *s);
185 // CHECK-LABEL: @test_strlen(
186 // CHECK: %[[i:.*]] = alloca i32
187 // CHECK: %[[call:.*]] = call i32 @strlen
188 // CHECK: store i32 %[[call]], ptr %[[i]]
189 void test_strlen(void) {
190 const char array[] = @encode(int);
191 int i = strlen(array);