John McCall | d1e40d5 | 2011-10-02 01:16:38 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -x objective-c %s.result |
| 2 | // RUN: arcmt-test --args -triple x86_64-apple-macosx10.7 -fsyntax-only %s > %t |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 3 | // RUN: diff %t %s.result |
Argyrios Kyrtzidis | d8b4216 | 2012-01-12 02:34:32 +0000 | [diff] [blame] | 4 | // DISABLE: mingw32 |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 5 | |
| 6 | #include "Common.h" |
| 7 | |
Argyrios Kyrtzidis | 86625b5 | 2011-07-12 22:05:17 +0000 | [diff] [blame] | 8 | __attribute__((objc_arc_weak_reference_unavailable)) |
| 9 | @interface WeakOptOut |
| 10 | @end |
| 11 | |
| 12 | @class _NSCachedAttributedString; |
Argyrios Kyrtzidis | 86625b5 | 2011-07-12 22:05:17 +0000 | [diff] [blame] | 13 | typedef _NSCachedAttributedString *BadClassForWeak; |
| 14 | |
Argyrios Kyrtzidis | 5363e8d | 2011-07-12 22:16:25 +0000 | [diff] [blame] | 15 | @class Forw; |
| 16 | |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 17 | @interface Foo : NSObject { |
Argyrios Kyrtzidis | 8b08eb3 | 2011-11-08 23:09:34 +0000 | [diff] [blame] | 18 | Foo *x, *w, *q1, *q2; |
Argyrios Kyrtzidis | 86625b5 | 2011-07-12 22:05:17 +0000 | [diff] [blame] | 19 | WeakOptOut *oo; |
| 20 | BadClassForWeak bcw; |
| 21 | id not_safe1; |
| 22 | NSObject *not_safe2; |
Argyrios Kyrtzidis | 5363e8d | 2011-07-12 22:16:25 +0000 | [diff] [blame] | 23 | Forw *not_safe3; |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 24 | Foo *assign_plus1; |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 25 | } |
Argyrios Kyrtzidis | 8b08eb3 | 2011-11-08 23:09:34 +0000 | [diff] [blame] | 26 | @property (readonly) Foo *x; |
Argyrios Kyrtzidis | 86625b5 | 2011-07-12 22:05:17 +0000 | [diff] [blame] | 27 | @property (assign) Foo *w; |
Argyrios Kyrtzidis | 14c4b44 | 2011-07-13 19:22:00 +0000 | [diff] [blame] | 28 | @property Foo *q1, *q2; |
Argyrios Kyrtzidis | 86625b5 | 2011-07-12 22:05:17 +0000 | [diff] [blame] | 29 | @property (assign) WeakOptOut *oo; |
| 30 | @property (assign) BadClassForWeak bcw; |
| 31 | @property (assign) id not_safe1; |
Argyrios Kyrtzidis | 14c4b44 | 2011-07-13 19:22:00 +0000 | [diff] [blame] | 32 | @property () NSObject *not_safe2; |
| 33 | @property Forw *not_safe3; |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 34 | @property (readonly) Foo *assign_plus1; |
| 35 | @property (readonly) Foo *assign_plus2; |
Argyrios Kyrtzidis | 94a9016 | 2011-08-10 21:46:48 +0000 | [diff] [blame] | 36 | @property (readonly) Foo *assign_plus3; |
Argyrios Kyrtzidis | 14c4b44 | 2011-07-13 19:22:00 +0000 | [diff] [blame] | 37 | |
Argyrios Kyrtzidis | 9688609 | 2011-07-13 19:47:57 +0000 | [diff] [blame] | 38 | @property (assign) Foo *no_user_ivar1; |
| 39 | @property (readonly) Foo *no_user_ivar2; |
Argyrios Kyrtzidis | 01b2b9b | 2011-10-17 23:14:16 +0000 | [diff] [blame] | 40 | |
| 41 | @property (retain) id def1; |
| 42 | @property (atomic,retain) id def2; |
| 43 | @property (retain,atomic) id def3; |
| 44 | |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 45 | @end |
| 46 | |
| 47 | @implementation Foo |
Argyrios Kyrtzidis | 14c4b44 | 2011-07-13 19:22:00 +0000 | [diff] [blame] | 48 | @synthesize x,w,q1,q2,oo,bcw,not_safe1,not_safe2,not_safe3; |
Argyrios Kyrtzidis | 9688609 | 2011-07-13 19:47:57 +0000 | [diff] [blame] | 49 | @synthesize no_user_ivar1, no_user_ivar2; |
Argyrios Kyrtzidis | 94a9016 | 2011-08-10 21:46:48 +0000 | [diff] [blame] | 50 | @synthesize assign_plus1, assign_plus2, assign_plus3; |
Argyrios Kyrtzidis | 01b2b9b | 2011-10-17 23:14:16 +0000 | [diff] [blame] | 51 | @synthesize def1, def2, def3; |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 52 | |
Argyrios Kyrtzidis | 94a9016 | 2011-08-10 21:46:48 +0000 | [diff] [blame] | 53 | -(void)test:(Foo *)parm { |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 54 | assign_plus1 = [[Foo alloc] init]; |
| 55 | assign_plus2 = [Foo new]; |
Argyrios Kyrtzidis | 94a9016 | 2011-08-10 21:46:48 +0000 | [diff] [blame] | 56 | assign_plus3 = [parm retain]; |
Argyrios Kyrtzidis | 18fd0c6 | 2011-07-27 05:28:18 +0000 | [diff] [blame] | 57 | } |
John McCall | 8f0e8d2 | 2011-06-15 23:25:17 +0000 | [diff] [blame] | 58 | @end |
Argyrios Kyrtzidis | 4467901 | 2011-10-18 19:49:19 +0000 | [diff] [blame] | 59 | |
| 60 | @interface TestExt |
| 61 | @property (retain,readonly) TestExt *x1; |
| 62 | @property (readonly) TestExt *x2; |
| 63 | @end |
| 64 | |
| 65 | @interface TestExt() |
| 66 | @property (retain,readwrite) TestExt *x1; |
| 67 | @property (readwrite) TestExt *x2; |
Argyrios Kyrtzidis | 0fd4a68 | 2012-03-29 01:10:31 +0000 | [diff] [blame] | 68 | @property (retain) TestExt *x3; |
Argyrios Kyrtzidis | 4467901 | 2011-10-18 19:49:19 +0000 | [diff] [blame] | 69 | @end |
| 70 | |
| 71 | @implementation TestExt |
Argyrios Kyrtzidis | 0fd4a68 | 2012-03-29 01:10:31 +0000 | [diff] [blame] | 72 | @synthesize x1, x2, x3; |
Argyrios Kyrtzidis | 4467901 | 2011-10-18 19:49:19 +0000 | [diff] [blame] | 73 | @end |