2012-06-20 14:18:46 +08:00
|
|
|
// RUN: %clang_cc1 %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep "_Block_object_dispose" %t | count 6
|
|
|
|
// RUN: grep "__copy_helper_block_" %t | count 4
|
|
|
|
// RUN: grep "__destroy_helper_block_" %t | count 4
|
2010-12-03 01:02:11 +08:00
|
|
|
// RUN: grep "__Block_byref_object_copy_" %t | count 2
|
|
|
|
// RUN: grep "__Block_byref_object_dispose_" %t | count 2
|
2013-07-04 23:22:16 +08:00
|
|
|
// RUN: not grep "i32 135)" %t
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: grep "_Block_object_assign" %t | count 4
|
|
|
|
// RUN: grep "objc_read_weak" %t | count 2
|
2009-04-21 08:51:43 +08:00
|
|
|
// RUN: grep "objc_assign_weak" %t | count 3
|
2012-06-20 14:18:46 +08:00
|
|
|
// RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o %t -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5
|
2010-05-20 07:07:54 +08:00
|
|
|
// RUN: grep "_Block_object_dispose" %t | count 6
|
|
|
|
// RUN: grep "__copy_helper_block_" %t | count 4
|
|
|
|
// RUN: grep "__destroy_helper_block_" %t | count 4
|
2010-12-03 01:02:11 +08:00
|
|
|
// RUN: grep "__Block_byref_object_copy_" %t | count 2
|
|
|
|
// RUN: grep "__Block_byref_object_dispose_" %t | count 2
|
2013-07-04 23:22:16 +08:00
|
|
|
// RUN: not grep "i32 135)" %t
|
2010-05-20 07:07:54 +08:00
|
|
|
// RUN: grep "_Block_object_assign" %t | count 4
|
|
|
|
// RUN: grep "objc_read_weak" %t | count 2
|
|
|
|
// RUN: grep "objc_assign_weak" %t | count 3
|
2009-04-11 07:09:55 +08:00
|
|
|
|
|
|
|
@interface NSDictionary @end
|
|
|
|
|
|
|
|
void test1(NSDictionary * dict) {
|
|
|
|
^{ (void)dict; }();
|
|
|
|
}
|
2009-04-14 08:57:29 +08:00
|
|
|
|
|
|
|
@interface D
|
|
|
|
@end
|
|
|
|
|
|
|
|
void foo() {
|
|
|
|
__block __weak D *weakSelf;
|
|
|
|
D *l;
|
|
|
|
l = weakSelf;
|
|
|
|
weakSelf = l;
|
|
|
|
}
|
2009-04-21 08:51:43 +08:00
|
|
|
|
|
|
|
void (^__weak b)(void);
|
|
|
|
|
|
|
|
void test2() {
|
|
|
|
__block int i = 0;
|
|
|
|
b = ^ { ++i; };
|
|
|
|
}
|