2011-06-12 15:46:16 +00:00
|
|
|
// REQUIRES: x86-registered-target,x86-64-registered-target
|
2011-10-20 21:14:49 +00:00
|
|
|
// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -S %s -o %t-64.s
|
2009-11-18 14:59:57 +00:00
|
|
|
// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
|
2011-10-20 21:14:49 +00:00
|
|
|
// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-fragile-abi -S %s -o %t-32.s
|
2009-11-18 14:59:57 +00:00
|
|
|
// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
|
2009-10-14 18:03:49 +00: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;
|
|
|
|
}
|
|
|
|
|
2010-01-01 10:34:51 +00:00
|
|
|
// CHECK-LP64: callq _objc_read_weak
|
|
|
|
// CHECK-LP64: callq _objc_read_weak
|
2009-10-14 18:03:49 +00:00
|
|
|
|
2011-02-20 13:06:31 +00:00
|
|
|
// CHECK-LP32: calll L_objc_read_weak
|
|
|
|
// CHECK-LP32: calll L_objc_read_weak
|