xref: /aosp_15_r20/external/clang/test/CodeGen/global-blocks-lines.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
2*67e74705SXin Li // Make sure we do not generate line info for debugging-related frame setup.
3*67e74705SXin Li // CHECK: define {{.*}}block_invoke
4*67e74705SXin Li // CHECK-NOT: store {{.*}}%struct.__block_descriptor*{{.*}}dbg
5*67e74705SXin Li // CHECK: store {{.*}}%struct.__block_descriptor*{{.*}}, align
6*67e74705SXin Li // CHECK: ret
7*67e74705SXin Li // CHECK: define {{.*}}block_invoke
8*67e74705SXin Li // CHECK-NOT: store {{.*}}%struct.__block_descriptor*{{.*}}dbg
9*67e74705SXin Li // CHECK: store {{.*}}%struct.__block_descriptor*{{.*}}, align
10*67e74705SXin Li // CHECK: ret
11*67e74705SXin Li // CHECK: define {{.*}}block_invoke
12*67e74705SXin Li // CHECK-NOT: store {{.*}}%struct.__block_descriptor*{{.*}}dbg
13*67e74705SXin Li // CHECK: store {{.*}}%struct.__block_descriptor*{{.*}}, align
14*67e74705SXin Li // CHECK: ret
15*67e74705SXin Li int printf(const char*, ...);
16*67e74705SXin Li 
17*67e74705SXin Li static void* _NSConcreteGlobalBlock;
18*67e74705SXin Li 
19*67e74705SXin Li 
20*67e74705SXin Li typedef void (^ HelloBlock_t)(const char * name);
21*67e74705SXin Li 
22*67e74705SXin Li   /* Breakpoint for first Block function.  */
23*67e74705SXin Li HelloBlock_t helloBlock = ^(const char * name) {
24*67e74705SXin Li   printf("Hello there, %s!\n", name);
25*67e74705SXin Li };
26*67e74705SXin Li 
27*67e74705SXin Li   /* Breakpoint for second Block function.  */
28*67e74705SXin Li static HelloBlock_t s_helloBlock = ^(const char * name) {
29*67e74705SXin Li   printf("Hello there, %s!\n", name);
30*67e74705SXin Li };
31*67e74705SXin Li 
32*67e74705SXin Li /* Breakpoint for third Block function.  */
33*67e74705SXin Li int X = 1234;
34*67e74705SXin Li int (^CP)(void) = ^{ X = X+1;  return X; };
35*67e74705SXin Li 
36*67e74705SXin Li int
main(int argc,char * argv[])37*67e74705SXin Li main(int argc, char * argv[])
38*67e74705SXin Li {
39*67e74705SXin Li   helloBlock("world");
40*67e74705SXin Li   s_helloBlock("world");
41*67e74705SXin Li 
42*67e74705SXin Li   CP();
43*67e74705SXin Li   printf ("X = %d\n", X);
44*67e74705SXin Li   return X - 1235;
45*67e74705SXin Li }
46