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