2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o %t -fblocks
|
2009-03-01 09:09:12 +08:00
|
|
|
void (^f)(void) = ^{};
|
2009-04-08 10:55:55 +08:00
|
|
|
|
|
|
|
// rdar://6768379
|
|
|
|
int f0(int (^a0)()) {
|
|
|
|
return a0(1, 2, 3);
|
|
|
|
}
|
2009-04-17 08:48:04 +08:00
|
|
|
|
|
|
|
// Verify that attributes on blocks are set correctly.
|
|
|
|
typedef struct s0 T;
|
|
|
|
struct s0 {
|
|
|
|
int a[64];
|
|
|
|
};
|
|
|
|
|
2010-04-20 13:44:43 +08:00
|
|
|
// RUN: grep 'internal void @__f2_block_invoke_(.struct.s0\* sret .*, .*, .* byval .*)' %t
|
2009-04-17 08:48:04 +08:00
|
|
|
struct s0 f2(struct s0 a0) {
|
|
|
|
return ^(struct s0 a1){ return a1; }(a0);
|
|
|
|
}
|
|
|
|
|
2009-04-21 12:41:23 +08:00
|
|
|
// This should not crash: rdar://6808051
|
|
|
|
void *P = ^{
|
|
|
|
void *Q = __func__;
|
|
|
|
};
|
|
|
|
|
2009-05-01 09:31:57 +08:00
|
|
|
void (^test1)(void) = ^(void) {
|
|
|
|
__block int i;
|
|
|
|
^ { i = 1; }();
|
|
|
|
};
|
2009-04-21 12:41:23 +08:00
|
|
|
|