1 | // |
2 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
3 | // See https://llvm.org/LICENSE.txt for license information. |
4 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
5 | |
6 | // |
7 | // byrefaccess.m |
8 | // test that byref access to locals is accurate |
9 | // testObjects |
10 | // |
11 | // Created by Blaine Garst on 5/13/08. |
12 | // |
13 | // CONFIG |
14 | |
15 | #include <stdio.h> |
16 | |
17 | |
18 | void callVoidVoid(void (^closure)(void)) { |
19 | closure(); |
20 | } |
21 | |
22 | int main(int argc, char *argv[]) { |
23 | __block int i = 10; |
24 | |
25 | callVoidVoid(closure: ^{ ++i; }); |
26 | |
27 | if (i != 11) { |
28 | printf(format: "*** %s didn't update i\n" , argv[0]); |
29 | return 1; |
30 | } |
31 | printf(format: "%s: success\n" , argv[0]); |
32 | return 0; |
33 | } |
34 | |