Galina Kistanova | 0ccb31c | 2011-06-03 22:24:54 +0000 | [diff] [blame] | 1 | // REQUIRES: x86-registered-target,x86-64-registered-target |
John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -S %s -o %t-64.s |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 3 | // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s |
John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 4 | // RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-fragile-abi -S %s -o %t-32.s |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 5 | // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s |
Fariborz Jahanian | f7bcc7e | 2009-10-10 20:07:56 +0000 | [diff] [blame] | 6 | |
| 7 | @interface NSObject |
| 8 | - copy; |
| 9 | @end |
| 10 | |
| 11 | int main() { |
| 12 | NSObject *object = 0; |
| 13 | __weak __block NSObject* weak_object = object; |
| 14 | void (^callback) (void) = [^{ |
| 15 | if (weak_object) |
| 16 | [weak_object copy]; |
| 17 | } copy]; |
| 18 | callback(); |
| 19 | return 0; |
| 20 | } |
| 21 | |
Sean Callanan | 3b29901 | 2009-12-18 00:04:09 +0000 | [diff] [blame] | 22 | // CHECK-LP64: callq _objc_read_weak |
| 23 | // CHECK-LP64: callq _objc_read_weak |
Fariborz Jahanian | f7bcc7e | 2009-10-10 20:07:56 +0000 | [diff] [blame] | 24 | |
Chris Lattner | 398e6b9 | 2010-09-22 06:09:31 +0000 | [diff] [blame] | 25 | // CHECK-LP32: calll L_objc_read_weak |
| 26 | // CHECK-LP32: calll L_objc_read_weak |