xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/objc-read-weak-byref.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | \
2*0a6a1f1dSLionel Sambuc// RUN: FileCheck %s
3*0a6a1f1dSLionel Sambuc// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | \
4*0a6a1f1dSLionel Sambuc// RUN: FileCheck %s
5f4a2713aSLionel Sambuc
6f4a2713aSLionel Sambuc@interface NSObject
7f4a2713aSLionel Sambuc- copy;
8f4a2713aSLionel Sambuc@end
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambucint main() {
11f4a2713aSLionel Sambuc    NSObject *object = 0;
12f4a2713aSLionel Sambuc    __weak __block NSObject* weak_object = object;
13f4a2713aSLionel Sambuc    void (^callback) (void) = [^{
14f4a2713aSLionel Sambuc        if (weak_object)
15f4a2713aSLionel Sambuc                [weak_object copy];
16f4a2713aSLionel Sambuc    } copy];
17f4a2713aSLionel Sambuc    callback();
18f4a2713aSLionel Sambuc    return 0;
19f4a2713aSLionel Sambuc}
20f4a2713aSLionel Sambuc
21*0a6a1f1dSLionel Sambuc// CHECK: call i8* @objc_read_weak
22*0a6a1f1dSLionel Sambuc// CHECK: call i8* @objc_read_weak
23