Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / BlocksRuntime / dispatch_call_Block_with_release.c
blob21e810f3cd95ddc6f014d4a29d81c3f1a359f8ef
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 #include <stdio.h>
7 #include <Block.h>
9 // CONFIG
11 void callsomething(const char *format, int argument) {
14 void
15 dispatch_call_Block_with_release2(void *block)
17 void (^b)(void) = (void (^)(void))block;
18 b();
19 Block_release(b);
22 int main(int argc, char *argv[]) {
23 void (^b1)(void) = ^{ callsomething("argc is %d\n", argc); };
24 void (^b2)(void) = ^{ callsomething("hellow world\n", 0); }; // global block now
26 dispatch_call_Block_with_release2(Block_copy(b1));
27 dispatch_call_Block_with_release2(Block_copy(b2));
28 printf("%s: Success\n", argv[0]);
29 return 0;