blob: 8fe1436567b1c807e7cda64315fe7d8466446915 [file] [log] [blame]
Galina Kistanova0ccb31c2011-06-03 22:24:54 +00001// REQUIRES: x86-registered-target,x86-64-registered-target
John McCalld1e40d52011-10-02 01:16:38 +00002// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-fragile-abi -S %s -o %t-64.s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00003// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s
John McCalld1e40d52011-10-02 01:16:38 +00004// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-fragile-abi -S %s -o %t-32.s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +00005// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s
Fariborz Jahanianf7bcc7e2009-10-10 20:07:56 +00006
7@interface NSObject
8- copy;
9@end
10
11int 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 Callanan3b299012009-12-18 00:04:09 +000022// CHECK-LP64: callq _objc_read_weak
23// CHECK-LP64: callq _objc_read_weak
Fariborz Jahanianf7bcc7e2009-10-10 20:07:56 +000024
Chris Lattner398e6b92010-09-22 06:09:31 +000025// CHECK-LP32: calll L_objc_read_weak
26// CHECK-LP32: calll L_objc_read_weak