xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/mangle-blocks.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -triple i386-apple-ios -fblocks -emit-llvm -o - %s -Wno-objc-root-class \
2*0a6a1f1dSLionel Sambuc// RUN:   | FileCheck %s
3*0a6a1f1dSLionel Sambuc
4*0a6a1f1dSLionel Sambucvoid __assert_rtn(const char *, const char *, int, const char *);
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc@interface Test
7*0a6a1f1dSLionel Sambuc- (void (^)(void)) mangle;
8*0a6a1f1dSLionel Sambuc@end
9*0a6a1f1dSLionel Sambuc
10*0a6a1f1dSLionel Sambuc@implementation Test
11*0a6a1f1dSLionel Sambuc- (void (^)(void)) mangle {
12*0a6a1f1dSLionel Sambuc  return ^() {
13*0a6a1f1dSLionel Sambuc    void (^b)(void) = ^() {
14*0a6a1f1dSLionel Sambuc      __assert_rtn(__func__, __FILE__, __LINE__, "mangle");
15*0a6a1f1dSLionel Sambuc    };
16*0a6a1f1dSLionel Sambuc  };
17*0a6a1f1dSLionel Sambuc}
18*0a6a1f1dSLionel Sambuc@end
19*0a6a1f1dSLionel Sambuc
20*0a6a1f1dSLionel Sambuc// CHECK: @"__func__.__14-[Test mangle]_block_invoke_2" = private unnamed_addr constant [34 x i8] c"__14-[Test mangle]_block_invoke_2\00", align 1
21*0a6a1f1dSLionel Sambuc// CHECK: @.str = private unnamed_addr constant {{.*}}, align 1
22*0a6a1f1dSLionel Sambuc// CHECK: @.str1 = private unnamed_addr constant [7 x i8] c"mangle\00", align 1
23*0a6a1f1dSLionel Sambuc
24*0a6a1f1dSLionel Sambuc// CHECK: define internal void @"__14-[Test mangle]_block_invoke"(i8* %.block_descriptor)
25*0a6a1f1dSLionel Sambuc
26*0a6a1f1dSLionel Sambuc// CHECK: define internal void @"__14-[Test mangle]_block_invoke_2"(i8* %.block_descriptor){{.*}}{
27*0a6a1f1dSLionel Sambuc// CHECK: call void @__assert_rtn(i8* getelementptr inbounds ([34 x i8]* @"__func__.__14-[Test mangle]_block_invoke_2", i32 0, i32 0), i8* getelementptr inbounds {{.*}}, i32 14, i8* getelementptr inbounds ([7 x i8]* @.str1, i32 0, i32 0))
28*0a6a1f1dSLionel Sambuc// CHECK: }
29*0a6a1f1dSLionel Sambuc
30