xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/tentative-cfconstantstring.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
2f4a2713aSLionel Sambuc// rdar://13598026
3f4a2713aSLionel Sambuc
4f4a2713aSLionel Sambuc@interface NSObject @end
5f4a2713aSLionel Sambuc
6f4a2713aSLionel Sambuc@class NSString;
7f4a2713aSLionel Sambuc
8f4a2713aSLionel Sambucint __CFConstantStringClassReference[24];
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambuc@interface Bar : NSObject
11f4a2713aSLionel Sambuc+(void)format:(NSString *)format,...;
12f4a2713aSLionel Sambuc@end
13f4a2713aSLionel Sambuc
14f4a2713aSLionel Sambuc@interface Foo : NSObject
15f4a2713aSLionel Sambuc@end
16f4a2713aSLionel Sambuc
17f4a2713aSLionel Sambuc
18f4a2713aSLionel Sambucstatic inline void _inlineFunction() {
19f4a2713aSLionel Sambuc    [Bar format:@" "];
20f4a2713aSLionel Sambuc}
21f4a2713aSLionel Sambuc
22f4a2713aSLionel Sambuc@implementation Foo
23f4a2713aSLionel Sambuc
24f4a2713aSLionel Sambuc
25f4a2713aSLionel Sambuc+(NSString *)someMethod {
26f4a2713aSLionel Sambuc   return @"";
27f4a2713aSLionel Sambuc}
28f4a2713aSLionel Sambuc
29f4a2713aSLionel Sambuc-(void)someMethod {
30f4a2713aSLionel Sambuc   _inlineFunction();
31f4a2713aSLionel Sambuc}
32f4a2713aSLionel Sambuc@end
33f4a2713aSLionel Sambuc
34f4a2713aSLionel Sambuc// CHECK: @__CFConstantStringClassReference = common global [24 x i32] zeroinitializer, align 16
35f4a2713aSLionel Sambuc// CHECK: @_unnamed_cfstring_{{.*}} = private constant %struct.NSConstantString { i32* getelementptr inbounds ([24 x i32]* @__CFConstantStringClassReference, i32 0, i32 0)
36f4a2713aSLionel Sambuc
37f4a2713aSLionel Sambuc// CHECK-LABEL: define internal void @_inlineFunction()
38*0a6a1f1dSLionel Sambuc// CHECK:  [[ZERO:%.*]] = load %struct._class_t** @"OBJC_CLASSLIST_REFERENCES_
39*0a6a1f1dSLionel Sambuc// CHECK-NEXT:   [[ONE:%.*]] = load i8** @OBJC_SELECTOR_REFERENCES_
40f4a2713aSLionel Sambuc// CHECK-NEXT:   [[TWO:%.*]] = bitcast %struct._class_t* [[ZERO]] to i8*
41f4a2713aSLionel Sambuc// CHECK-NEXT:   call void (i8*, i8*, [[T:%.*]]*, ...)* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, [[T:%.*]]*, ...)*)(i8* [[TWO]], i8* [[ONE]], [[T:%.*]]* bitcast (%struct.NSConstantString* @_unnamed_cfstring_{{.*}} to [[T:%.*]]*))
42f4a2713aSLionel Sambuc// CHECK-NEXT:   ret void
43f4a2713aSLionel Sambuc
44