| John McCall | 24fc0de | 2011-07-06 00:26:06 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fblocks -fsyntax-only -fobjc-arc -x objective-c -fobjc-runtime-has-weak %s.result | 
| Argyrios Kyrtzidis | bdf3ca9 | 2011-06-16 02:41:46 +0000 | [diff] [blame] | 2 | // RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fobjc-nonfragile-abi -fblocks -fsyntax-only %s > %t | 
| John McCall | d70fb98 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 3 | // RUN: diff %t %s.result | 
|  | 4 |  | 
|  | 5 | #include "Common.h" | 
|  | 6 |  | 
|  | 7 | @interface Foo : NSObject | 
|  | 8 | -(Foo *)something; | 
|  | 9 | @end | 
|  | 10 |  | 
|  | 11 | void bar(void (^block)()); | 
|  | 12 |  | 
|  | 13 | void test1(Foo *p) { | 
|  | 14 | __block Foo *x = p; // __block used just to break cycle. | 
|  | 15 | bar(^{ | 
|  | 16 | [x something]; | 
|  | 17 | }); | 
|  | 18 | } | 
|  | 19 |  | 
|  | 20 | void test2(Foo *p) { | 
|  | 21 | __block Foo *x; // __block used as output variable. | 
|  | 22 | bar(^{ | 
|  | 23 | x = [p something]; | 
|  | 24 | }); | 
|  | 25 | } |