[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / global-blocks-lines.c
blob946617389236b521b3f6c5faece2d04c9c0813e4
1 // RUN: %clang_cc1 -fblocks -debug-info-kind=limited -emit-llvm %s -o - | FileCheck %s
2 // Make sure we do not generate line info for debugging-related frame setup.
3 // CHECK: define {{.*}}block_invoke
4 // CHECK-NOT: store {{.*}}ptr{{.*}}dbg
5 // CHECK: store {{.*}}ptr{{.*}}, align
6 // CHECK: ret
7 // CHECK: define {{.*}}block_invoke
8 // CHECK-NOT: store {{.*}}ptr{{.*}}dbg
9 // CHECK: store {{.*}}ptr{{.*}}, align
10 // CHECK: ret
11 // CHECK: define {{.*}}block_invoke
12 // CHECK-NOT: store {{.*}}ptr{{.*}}dbg
13 // CHECK: store {{.*}}ptr{{.*}}, align
14 // CHECK: ret
15 int printf(const char*, ...);
17 static void* _NSConcreteGlobalBlock;
20 typedef void (^ HelloBlock_t)(const char * name);
22 /* Breakpoint for first Block function. */
23 HelloBlock_t helloBlock = ^(const char * name) {
24 printf("Hello there, %s!\n", name);
27 /* Breakpoint for second Block function. */
28 static HelloBlock_t s_helloBlock = ^(const char * name) {
29 printf("Hello there, %s!\n", name);
32 /* Breakpoint for third Block function. */
33 int X = 1234;
34 int (^CP)(void) = ^{ X = X+1; return X; };
36 int
37 main(int argc, char * argv[])
39 helloBlock("world");
40 s_helloBlock("world");
42 CP();
43 printf ("X = %d\n", X);
44 return X - 1235;