2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -S %s -o %t-64.s
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
|
2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s
|
2009-11-08 09:45:36 +08:00
|
|
|
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %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;
|
|
|
|
}
|
|
|
|
|
2009-12-18 08:04:09 +08:00
|
|
|
// CHECK-LP64: callq _objc_read_weak
|
|
|
|
// CHECK-LP64: callq _objc_read_weak
|
2009-10-11 04:07:56 +08:00
|
|
|
|
2010-09-22 14:09:31 +08:00
|
|
|
// CHECK-LP32: calll L_objc_read_weak
|
|
|
|
// CHECK-LP32: calll L_objc_read_weak
|