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
6@class NSString;
7
8// rdar://19140267
9@protocol NSObject
10@property (readonly, copy) NSString *description;
11@end
12
13// rdar://18498572
14@interface NSObject <NSObject> @end
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
26P* fun();
27
28@implementation P
29- (int) Meth : (P*)array {
30  obj.count = 100;
31
32  ((P*)0).count = array.count;
33
34  obj.PropertyReturnsPObj.count = array.count;
35
36  obj.count = (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; }
46
47- (NSString *)description { return super.description; }
48@end
49
50// rdar://19140267
51@interface Sub : P
52@end
53
54@implementation Sub
55- (int) Meth : (P*)array {
56  super.count = 100;
57
58  super.count = array.count;
59
60  super.PropertyReturnsPObj.count = array.count;
61
62  super.count = (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
77id 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.count = 100;
97  [some setCount : [some count]];
98  qsome.count = qsome.count;
99}
100@end
101
102// rdar://19140114
103int NSOnState;
104int 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.state = NSOnState;
115  menuItem.state = NSOnState;
116  menuItem.state = ArrNSOnState[NSOnState];
117  menuItem.state = NSOnState;
118  menuItem.state = NSOnState;
119  menuItem.state = NSOnState;
120  menuItem.state = NSOnState;
121}
122@end
123