Home | History | Annotate | Download | only in FrontendC
      1 // RUN: %llvmgcc %s -S -O2 -o %t.s
      2 // RUN: grep {call i32 .*printf.*argc} %t.s | count 3
      3 // RUN: not grep __block_holder_tmp %t.s
      4 // rdar://5865221
      5 
      6 // All of these should be inlined equivalently into a single printf call.
      7 
      8 static int fun(int x) {
      9 	return x+1;
     10 }
     11 
     12 static int block(int x) {
     13 	return (^(int x){return x+1;})(x);
     14 }
     15 
     16 static void print(int result) {
     17     printf("%d\n", result);
     18 }
     19 
     20 int main (int argc, const char * argv[]) {
     21     int	x = argc-1;
     22     print(fun(x));
     23     print(block(x));
     24     int	(^block_inline)(int) = ^(int x){return x+1;};
     25     print(block_inline(x));
     26     return 0;
     27 }
     28 
     29