1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00
llvm-mirror/test/FrontendObjC/2009-01-26-WriteBarrier-2.m

15 lines
450 B
Mathematica
Raw Normal View History

2009-01-27 00:22:19 +01:00
// RUN: %llvmgcc -x objective-c -S %s -fobjc-gc -o - | grep objc_assign_strongCast
// rdar://5541393
typedef struct {
void (^ivarBlock)(void);
} StructWithBlock_t;
int main(char *argc, char *argv[]) {
StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*));
__block int i = 10;
// assigning a Block into an struct slot should elicit a write-barrier under GC
swbp->ivarBlock = ^ { ++i; };
return 0;
}