Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / BlocksRuntime / byrefcopyint.c
blobb9148cb667e6dd965e86e2e31d9699fe3873bc5b
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
6 /*
7 * byrefcopyint.c
8 * testObjects
10 * Created by Blaine Garst on 12/1/08.
15 // byrefcopyid.m
16 // testObjects
18 // Created by Blaine Garst on 5/13/08.
21 // Tests copying of blocks with byref ints
22 // CONFIG rdar://6414583 -C99
24 #include <stdio.h>
25 #include <string.h>
26 #include <Block.h>
27 #include <Block_private.h>
32 typedef void (^voidVoid)(void);
34 voidVoid dummy;
36 void callVoidVoid(voidVoid closure) {
37 closure();
41 voidVoid testRoutine(const char *whoami) {
42 __block int dumbo = strlen(whoami);
43 dummy = ^{
44 //printf("incring dumbo from %d\n", dumbo);
45 ++dumbo;
49 voidVoid copy = Block_copy(dummy);
52 return copy;
55 int main(int argc, char *argv[]) {
56 voidVoid array[100];
57 for (int i = 0; i < 100; ++i) {
58 array[i] = testRoutine(argv[0]);
59 array[i]();
61 for (int i = 0; i < 100; ++i) {
62 Block_release(array[i]);
66 printf("%s: success\n", argv[0]);
67 return 0;