Home | History | Annotate | Download | only in CodeGenObjC
      1 // RUN: %clang_cc1 -fblocks -emit-llvm %s -fobjc-gc -o - | FileCheck %s
      2 
      3 // CHECK: objc_assign_strongCast
      4 // rdar://5541393
      5 
      6 typedef __SIZE_TYPE__ size_t;
      7 void * malloc(size_t size);
      8 
      9 typedef struct {
     10     void (^ivarBlock)(void);
     11 } StructWithBlock_t;
     12 
     13 int main(int argc, char *argv[]) {
     14    StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*));
     15    __block   int i = 10;
     16    // assigning a Block into an struct slot should elicit a write-barrier under GC
     17    swbp->ivarBlock = ^ { ++i; };
     18    return 0;
     19 }
     20