xref: /llvm-project/cross-project-tests/debuginfo-tests/llgdb-tests/block_var.m (revision 1364750dadbb56032ef73b4d0d8cbc88a51392da)
1// RUN: %clang %target_itanium_abi_host_triple -O0 -g %s -c -o %t.o
2// RUN: %clang %target_itanium_abi_host_triple %t.o -o %t.out -framework Foundation
3// RUN: %test_debuginfo %s %t.out
4
5// REQUIRES: system-darwin
6
7// DEBUGGER: break 24
8// DEBUGGER: r
9// DEBUGGER: p result
10// CHECK: ${{[0-9]}} = 42
11
12void doBlock(void (^block)(void))
13{
14    block();
15}
16
17int I(int n)
18{
19    __block int result;
20    int i = 2;
21    doBlock(^{
22        result = n;
23    });
24    return result + i; /* Check value of 'result' */
25}
26
27
28int main (int argc, const char * argv[]) {
29  return I(42);
30}
31
32
33