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 | * blockimport.c |
8 | * testObjects |
9 | * |
10 | * Created by Blaine Garst on 10/13/08. |
11 | * |
12 | */ |
13 | |
14 | |
15 | // |
16 | // pure C nothing more needed |
17 | // CONFIG rdar://6289344 |
18 | |
19 | #include <stdio.h> |
20 | #include <Block.h> |
21 | #include <Block_private.h> |
22 | |
23 | |
24 | |
25 | |
26 | int main(int argc, char *argv[]) { |
27 | int i = 1; |
28 | int (^intblock)(void) = ^{ return i*10; }; |
29 | |
30 | void (^vv)(void) = ^{ |
31 | if (argc > 0) { |
32 | printf(format: "intblock returns %d\n" , intblock()); |
33 | } |
34 | }; |
35 | |
36 | #if 0 |
37 | //printf("Block dump %s\n", _Block_dump(vv)); |
38 | { |
39 | struct Block_layout *layout = (struct Block_layout *)(void *)vv; |
40 | printf("isa %p\n" , layout->isa); |
41 | printf("flags %x\n" , layout->flags); |
42 | printf("descriptor %p\n" , layout->descriptor); |
43 | printf("descriptor->size %d\n" , layout->descriptor->size); |
44 | } |
45 | #endif |
46 | void (^vvcopy)(void) = Block_copy(vv); |
47 | Block_release(vvcopy); |
48 | printf(format: "%s: success\n" , argv[0]); |
49 | return 0; |
50 | } |
51 | |