blob: 76bfd59e41d1442ad3b6bc14abf1bc394cf56dd3 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00002// 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_id_object_copy_" %t | count 2
6// RUN: grep "__Block_byref_id_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
Mike Stump75b163f2009-04-21 00:51:43 +000010// RUN: grep "objc_assign_weak" %t | count 3
Mike Stumpc0c0ef02009-04-10 23:09:55 +000011
12@interface NSDictionary @end
13
14void test1(NSDictionary * dict) {
15 ^{ (void)dict; }();
16}
Mike Stumpf33651c2009-04-14 00:57:29 +000017
18@interface D
19@end
20
21void foo() {
22 __block __weak D *weakSelf;
23 D *l;
24 l = weakSelf;
25 weakSelf = l;
26}
Mike Stump75b163f2009-04-21 00:51:43 +000027
28void (^__weak b)(void);
29
30void test2() {
31 __block int i = 0;
32 b = ^ { ++i; };
33}