Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / instantiate-blocks.cpp
blob820baa8324559573ccd74d486e336d4a1693e375
1 // RUN: %clang_cc1 -fblocks -emit-llvm -o - %s
3 template <typename T> T foo(T t)
5 void (^block)(int);
6 return 1;
9 int test1(void)
11 int i = 1;
12 int b = 2;
13 i = foo(b);
14 return 0;
17 template <typename T, typename T1> void foo(T t, T1 r)
19 T block_arg;
20 __block T1 byref_block_arg;
22 T1 (^block)(char, T, T1, double) =
23 ^ T1 (char ch, T arg, T1 arg2, double d1) { byref_block_arg = arg2;
24 return byref_block_arg + block_arg + arg; };
26 void (^block2)() = ^{};
29 void test2(void)
31 foo(100, 'a');
34 namespace rdar6182276 {
35 extern "C" {
36 int printf(const char *, ...);
39 template <typename T> T foo(T t)
41 void (^testing)(int) = ^(int bar) { printf("bar is %d\n", bar); };
42 printf("bar is\n");
43 return 1;
46 template <typename T> void gorf(T t)
48 foo(t);
52 void test(void)
54 gorf(2);