• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <stdio.h>
7 #include <Block.h>
8 
9 // CONFIG
10 
callsomething(const char * format,int argument)11 void callsomething(const char *format, int argument) {
12 }
13 
14 void
dispatch_call_Block_with_release2(void * block)15 dispatch_call_Block_with_release2(void *block)
16 {
17         void (^b)(void) = (void (^)(void))block;
18         b();
19         Block_release(b);
20 }
21 
main(int argc,char * argv[])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
25 
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;
30 }
31