Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // RUN: %clang_cc1 -objcmt-migrate-property-dot-syntax -mt-migrate-directory %t %s -x objective-c -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin11 |
| 3 | // RUN: c-arcmt-test -mt-migrate-directory %t | arcmt-test -verify-transformed-files %s.result |
| 4 | // RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin10 -fsyntax-only -x objective-c -fobjc-runtime-has-weak -fobjc-arc %s.result |
| 5 | |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 6 | @class NSString; |
| 7 | |
| 8 | // rdar://19140267 |
| 9 | @protocol NSObject |
| 10 | @property (readonly, copy) NSString *description; |
| 11 | @end |
| 12 | |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 13 | // rdar://18498572 |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 14 | @interface NSObject <NSObject> @end |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 15 | |
| 16 | @interface P : NSObject |
| 17 | { |
| 18 | P* obj; |
| 19 | int i1, i2, i3; |
| 20 | } |
| 21 | @property int count; |
| 22 | @property (copy) P* PropertyReturnsPObj; |
| 23 | - (P*) MethodReturnsPObj; |
| 24 | @end |
| 25 | |
| 26 | P* fun(); |
| 27 | |
| 28 | @implementation P |
| 29 | - (int) Meth : (P*)array { |
| 30 | [obj setCount : 100]; |
| 31 | |
| 32 | [(P*)0 setCount : [array count]]; |
| 33 | |
| 34 | [[obj PropertyReturnsPObj] setCount : [array count]]; |
| 35 | |
| 36 | [obj setCount : (i1+i2*i3 - 100)]; |
| 37 | |
| 38 | return [obj count] - |
| 39 | [(P*)0 count] + [array count] + |
| 40 | [fun() count] - |
| 41 | [[obj PropertyReturnsPObj] count] + |
| 42 | [self->obj count]; |
| 43 | } |
| 44 | |
| 45 | - (P*) MethodReturnsPObj { return 0; } |
Pirama Arumuga Nainar | 3ea9e33 | 2015-04-08 08:57:32 -0700 | [diff] [blame] | 46 | |
| 47 | - (NSString *)description { return [super description]; } |
Stephen Hines | 176edba | 2014-12-01 14:53:08 -0800 | [diff] [blame] | 48 | @end |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 49 | |
| 50 | // rdar://19140267 |
| 51 | @interface Sub : P |
| 52 | @end |
| 53 | |
| 54 | @implementation Sub |
| 55 | - (int) Meth : (P*)array { |
| 56 | [super setCount : 100]; |
| 57 | |
| 58 | [super setCount : [array count]]; |
| 59 | |
| 60 | [[super PropertyReturnsPObj] setCount : [array count]]; |
| 61 | |
| 62 | [super setCount : (i1+i2*i3 - 100)]; |
| 63 | |
| 64 | return [super count] - |
| 65 | [(P*)0 count] + [array count] + |
| 66 | [fun() count] - |
| 67 | [[super PropertyReturnsPObj] count] + |
| 68 | [self->obj count]; |
| 69 | } |
| 70 | @end |
| 71 | |
| 72 | |
| 73 | @interface Rdar19038838 |
| 74 | @property id newItem; // should be marked objc_method_family(none), but isn't. |
| 75 | @end |
| 76 | |
| 77 | id testRdar19038838(Rdar19038838 *obj) { |
| 78 | return [obj newItem]; |
| 79 | } |
| 80 | |
| 81 | // rdar://19381786 |
| 82 | @interface rdar19381786 : NSObject |
| 83 | { |
| 84 | rdar19381786* obj; |
| 85 | } |
| 86 | @property int count; |
| 87 | @end |
| 88 | |
| 89 | @protocol PR |
| 90 | @property int count; |
| 91 | @end |
| 92 | |
| 93 | @implementation rdar19381786 |
| 94 | -(void)test:(id)some : (id<PR>)qsome : (SEL)selsome |
| 95 | { |
| 96 | [obj setCount : 100]; |
| 97 | [some setCount : [some count]]; |
| 98 | [qsome setCount : [qsome count]]; |
| 99 | } |
| 100 | @end |
| 101 | |
| 102 | // rdar://19140114 |
| 103 | int NSOnState; |
| 104 | int ArrNSOnState[4]; |
| 105 | @interface rdar19140114 : NSObject |
| 106 | { |
| 107 | rdar19140114* menuItem; |
| 108 | } |
| 109 | @property int state; |
| 110 | @end |
| 111 | |
| 112 | @implementation rdar19140114 |
| 113 | - (void) Meth { |
| 114 | [menuItem setState:NSOnState]; |
| 115 | [menuItem setState :NSOnState]; |
| 116 | [menuItem setState :ArrNSOnState[NSOnState]]; |
| 117 | [menuItem setState : NSOnState]; |
| 118 | [menuItem setState: NSOnState]; |
| 119 | [menuItem setState: NSOnState]; |
| 120 | [menuItem setState : NSOnState]; |
| 121 | } |
| 122 | @end |