]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenObjC/objc-read-weak-byref.m
Vendor import of clang release_30 branch r142614:
[FreeBSD/FreeBSD.git] / test / CodeGenObjC / objc-read-weak-byref.m
1 // REQUIRES: x86-registered-target,x86-64-registered-target
2 // RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -S %s -o %t-64.s
3 // RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
4 // RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-fragile-abi -S %s -o %t-32.s
5 // RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
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
22 // CHECK-LP64: callq    _objc_read_weak
23 // CHECK-LP64: callq    _objc_read_weak
24
25 // CHECK-LP32: calll     L_objc_read_weak
26 // CHECK-LP32: calll     L_objc_read_weak