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
8 #include <Block_private.h>
16 int doSomething(int i
) {
23 int j
= doSomething(i
);
24 int k
= doSomething(j
);
25 doSomething(i
+ j
+ k
);
28 typedef void (^voidVoid
)(void);
30 voidVoid
testFunction() {
32 __block voidVoid inner
= ^{ doSomething(i
); };
33 //printf("inner, on stack, is %p\n", (void*)inner);
34 /*__block*/ voidVoid outer
= ^{
35 //printf("will call inner block %p\n", (void *)inner);
38 //printf("outer looks like: %s\n", _Block_dump(outer));
39 voidVoid result
= Block_copy(outer
);
40 //Block_release(inner);
45 int main(int argc
, char **argv
) {
46 voidVoid block
= testFunction();
51 printf("%s: success\n", argv
[0]);