brintos

brintos / llvm-project-archived public Read only

0
0
Text · 511 B · e6bc7b1 Raw
19 lines · plain
1// RUN: %clang_cc1 -fblocks -emit-llvm %s -fobjc-gc -o - | FileCheck %s2 3// CHECK: objc_assign_strongCast4 5typedef __SIZE_TYPE__ size_t;6void * malloc(size_t size);7 8typedef struct {9    void (^ivarBlock)(void);10} StructWithBlock_t;11 12int main(int argc, char *argv[]) {13   StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*));14   __block   int i = 10;15   // assigning a Block into an struct slot should elicit a write-barrier under GC16   swbp->ivarBlock = ^ { ++i; };17   return 0;18}19