Home | History | Annotate | Download | only in CodeGenObjC
      1 // RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5
      2 // RUN: grep "_Block_object_dispose" %t | count 6
      3 // RUN: grep "__copy_helper_block_" %t | count 4
      4 // RUN: grep "__destroy_helper_block_" %t | count 4
      5 // RUN: grep "__Block_byref_object_copy_" %t | count 2
      6 // RUN: grep "__Block_byref_object_dispose_" %t | count 2
      7 // RUN: grep "i32 135)" %t | count 0
      8 // RUN: grep "_Block_object_assign" %t | count 4
      9 // RUN: grep "objc_read_weak" %t | count 2
     10 // RUN: grep "objc_assign_weak" %t | count 3
     11 // RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5
     12 // RUN: grep "_Block_object_dispose" %t | count 6
     13 // RUN: grep "__copy_helper_block_" %t | count 4
     14 // RUN: grep "__destroy_helper_block_" %t | count 4
     15 // RUN: grep "__Block_byref_object_copy_" %t | count 2
     16 // RUN: grep "__Block_byref_object_dispose_" %t | count 2
     17 // RUN: grep "i32 135)" %t | count 0
     18 // RUN: grep "_Block_object_assign" %t | count 4
     19 // RUN: grep "objc_read_weak" %t | count 2
     20 // RUN: grep "objc_assign_weak" %t | count 3
     21 
     22 @interface NSDictionary @end
     23 
     24 void test1(NSDictionary * dict) {
     25   ^{ (void)dict; }();
     26 }
     27 
     28 @interface D
     29 @end
     30 
     31 void foo() {
     32   __block __weak D *weakSelf;
     33   D *l;
     34   l = weakSelf;
     35   weakSelf = l;
     36 }
     37 
     38 void (^__weak b)(void);
     39 
     40 void test2() {
     41   __block int i = 0;
     42   b = ^ {  ++i; };
     43 }
     44