Argyrios Kyrtzidis | 12192cf | 2011-11-07 18:40:29 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -x objective-c %s.result |
| 2 | // RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -x objective-c %s > %t |
Argyrios Kyrtzidis | e0ac745 | 2011-11-04 15:58:08 +0000 | [diff] [blame] | 3 | // RUN: diff %t %s.result |
Argyrios Kyrtzidis | 12192cf | 2011-11-07 18:40:29 +0000 | [diff] [blame] | 4 | // RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only -fobjc-gc-only -x objective-c++ %s > %t |
Argyrios Kyrtzidis | 0d579b6 | 2011-11-04 15:58:13 +0000 | [diff] [blame] | 5 | // RUN: diff %t %s.result |
Argyrios Kyrtzidis | d8b4216 | 2012-01-12 02:34:32 +0000 | [diff] [blame] | 6 | // DISABLE: mingw32 |
Argyrios Kyrtzidis | e0ac745 | 2011-11-04 15:58:08 +0000 | [diff] [blame] | 7 | |
| 8 | #include "Common.h" |
Argyrios Kyrtzidis | 17ac319 | 2011-11-06 18:58:17 +0000 | [diff] [blame] | 9 | #include "GC.h" |
Argyrios Kyrtzidis | e0ac745 | 2011-11-04 15:58:08 +0000 | [diff] [blame] | 10 | |
| 11 | void test1(CFTypeRef *cft) { |
| 12 | id x = CFBridgingRelease(cft); |
| 13 | } |
Argyrios Kyrtzidis | e7ef855 | 2011-11-04 15:58:22 +0000 | [diff] [blame] | 14 | |
Argyrios Kyrtzidis | 17ac319 | 2011-11-06 18:58:17 +0000 | [diff] [blame] | 15 | @interface I1 { |
| 16 | I1 *myivar; |
| 17 | } |
Argyrios Kyrtzidis | e7ef855 | 2011-11-04 15:58:22 +0000 | [diff] [blame] | 18 | @end |
| 19 | |
| 20 | @implementation I1 |
| 21 | -(void)dealloc { |
| 22 | // dealloc |
| 23 | test1(0); |
| 24 | } |
| 25 | |
| 26 | @end |
| 27 | |
| 28 | @interface I2 |
Fariborz Jahanian | 86f9601 | 2012-01-20 19:15:02 +0000 | [diff] [blame] | 29 | @property (strong) id prop; |
Argyrios Kyrtzidis | e7ef855 | 2011-11-04 15:58:22 +0000 | [diff] [blame] | 30 | @end |
| 31 | |
| 32 | @implementation I2 |
| 33 | @synthesize prop; |
| 34 | |
| 35 | -(void)dealloc { |
| 36 | // finalize |
| 37 | test1(0); |
| 38 | } |
| 39 | @end |
Argyrios Kyrtzidis | 12192cf | 2011-11-07 18:40:29 +0000 | [diff] [blame] | 40 | |
| 41 | __attribute__((objc_arc_weak_reference_unavailable)) |
| 42 | @interface QQ { |
| 43 | __weak id s; |
| 44 | __unsafe_unretained QQ *q; |
| 45 | } |
| 46 | @end |
Argyrios Kyrtzidis | b0e1e12 | 2011-11-07 18:46:46 +0000 | [diff] [blame] | 47 | |
| 48 | @interface I3 |
| 49 | @property (weak) I3 * pw1, * pw2; |
| 50 | @property (strong) I3 * ps; |
| 51 | @property (assign) I3 * pds; |
| 52 | @end |
| 53 | |
| 54 | @interface I4Impl { |
| 55 | I4Impl *pds2; |
Argyrios Kyrtzidis | ae7c25d | 2011-11-08 05:56:11 +0000 | [diff] [blame] | 56 | I4Impl *pds3; |
Argyrios Kyrtzidis | 6d7d16d | 2011-11-28 00:23:12 +0000 | [diff] [blame] | 57 | __weak I4Impl *pw3; |
| 58 | __weak I4Impl *pw4; |
Argyrios Kyrtzidis | b0e1e12 | 2011-11-07 18:46:46 +0000 | [diff] [blame] | 59 | } |
| 60 | @property (weak) I4Impl * pw1, * pw2; |
| 61 | @property I4Impl * ps; |
| 62 | @property I4Impl * pds; |
| 63 | @property I4Impl * pds2; |
Argyrios Kyrtzidis | ae7c25d | 2011-11-08 05:56:11 +0000 | [diff] [blame] | 64 | @property (readwrite) I4Impl * pds3; |
Argyrios Kyrtzidis | af9b5e9 | 2011-11-08 22:10:58 +0000 | [diff] [blame] | 65 | @property (readonly) I4Impl * pds4; |
Argyrios Kyrtzidis | 6d7d16d | 2011-11-28 00:23:12 +0000 | [diff] [blame] | 66 | @property (weak, readonly) I4Impl *pw3; |
| 67 | @property (weak) I4Impl *pw4; |
Argyrios Kyrtzidis | b0e1e12 | 2011-11-07 18:46:46 +0000 | [diff] [blame] | 68 | @end |
| 69 | |
| 70 | @implementation I4Impl |
Argyrios Kyrtzidis | 6d7d16d | 2011-11-28 00:23:12 +0000 | [diff] [blame] | 71 | @synthesize pw1, pw2, pw3, pw4, ps, pds, pds2, pds3, pds4; |
Argyrios Kyrtzidis | a33849b | 2011-11-07 18:46:50 +0000 | [diff] [blame] | 72 | |
| 73 | -(void)test1:(CFTypeRef *)cft { |
| 74 | id x = CFBridgingRelease(cft); |
| 75 | } |
Argyrios Kyrtzidis | b0e1e12 | 2011-11-07 18:46:46 +0000 | [diff] [blame] | 76 | @end |