2013-12-03 22:46:31 +08:00
|
|
|
// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | \
|
|
|
|
// RUN: FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | \
|
|
|
|
// RUN: FileCheck %s
|
2009-10-11 04:07:56 +08:00
|
|
|
|
|
|
|
@interface NSObject
|
|
|
|
- copy;
|
|
|
|
@end
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
NSObject *object = 0;
|
|
|
|
__weak __block NSObject* weak_object = object;
|
|
|
|
void (^callback) (void) = [^{
|
|
|
|
if (weak_object)
|
|
|
|
[weak_object copy];
|
|
|
|
} copy];
|
|
|
|
callback();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-12-03 22:46:31 +08:00
|
|
|
// CHECK: call i8* @objc_read_weak
|
|
|
|
// CHECK: call i8* @objc_read_weak
|