xref: /minix3/external/bsd/llvm/dist/clang/test/PCH/blocks.h (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Header for PCH test blocks.c
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int call_block(int (^bl)(int x, int y), int a, int b) {
4*f4a2713aSLionel Sambuc   return bl(a, b);
5*f4a2713aSLionel Sambuc }
6*f4a2713aSLionel Sambuc 
add(int a,int b)7*f4a2713aSLionel Sambuc int add(int a, int b) {
8*f4a2713aSLionel Sambuc   return call_block(^(int x, int y) { return x + y; }, a, b);
9*f4a2713aSLionel Sambuc }
10*f4a2713aSLionel Sambuc 
scaled_add(int a,int b,int s)11*f4a2713aSLionel Sambuc int scaled_add(int a, int b, int s) {
12*f4a2713aSLionel Sambuc   __block int scale = s;
13*f4a2713aSLionel Sambuc   return call_block(^(int x, int y) { return x*scale + y; }, a, b);
14*f4a2713aSLionel Sambuc }
15