1 // RUN: rm -rf %t 2 // RUN: %clang_cc1 -fblocks -objcmt-migrate-readwrite-property -objcmt-migrate-readonly-property -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 #define WEBKIT_OBJC_METHOD_ANNOTATION(ANNOTATION) ANNOTATION 7 #define WEAK_IMPORT_ATTRIBUTE __attribute__((objc_arc_weak_reference_unavailable)) 8 #define AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER 9 #define DEPRECATED __attribute__((deprecated)) 10 11 typedef char BOOL; 12 @class NSString; 13 @protocol NSCopying @end 14 15 @interface NSObject <NSCopying> 16 @end 17 18 @interface NSDictionary : NSObject 19 @end 20 21 @interface I : NSObject { 22 int ivarVal; 23 } 24 @property (nonatomic, weak) NSString *WeakProp; 25 26 @property (nonatomic, strong) NSString *StrongProp; 27 28 @property (nonatomic, strong) NSString *UnavailProp __attribute__((unavailable)); 29 - (void) setUnavailProp : (NSString *)Val; 30 31 @property (nonatomic, strong) NSString *UnavailProp1 __attribute__((unavailable)); 32 33 @property (nonatomic, strong) NSString *UnavailProp2; 34 - (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable)); 35 36 @property (nonatomic, copy) NSDictionary *undoAction; 37 @end 38 39 @implementation I 40 @end 41 42 @class NSArray; 43 44 @interface MyClass2 { 45 @private 46 NSArray *_names1; 47 NSArray *_names2; 48 NSArray *_names3; 49 NSArray *_names4; 50 } 51 @property (nonatomic, strong) NSArray *names2; 52 @property (nonatomic, strong) NSArray *names3; 53 @property (nonatomic, strong) NSArray *names4; 54 @property (nonatomic, strong) NSArray *names1; 55 @end 56 57 // Properties that contain the name "delegate" or "dataSource", 58 // or have exact name "target" have unsafe_unretained attribute. 59 @interface NSInvocation 60 @property (nonatomic, assign) id target; 61 62 @property (nonatomic, assign) id dataSource; 63 64 // rdar://15509831 65 @property (nonatomic, readonly, assign) id delegate; 66 67 @property (nonatomic, assign) id xxxdelegateYYY; 68 69 70 @property (nonatomic, strong) id MYtarget; 71 72 @property (nonatomic, strong) id targetX; 73 74 @property (nonatomic) int value; 75 76 @property (nonatomic, getter=isContinuous) BOOL continuous; 77 78 - (id) isAnObject; 79 - (void)setAnObject : (id) object; 80 81 @property (nonatomic, getter=isinValid, readonly) BOOL inValid; 82 - (void) setInValid : (BOOL) arg; 83 84 - (void) Nothing; 85 @property (nonatomic, readonly) int Length; 86 @property (nonatomic, readonly, strong) id object; 87 + (double) D; 88 @property (nonatomic, readonly) void *JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER); 89 @property (nonatomic, getter=isIgnoringInteractionEvents, readonly) BOOL ignoringInteractionEvents; 90 91 @property (nonatomic, getter=getStringValue, strong) NSString *stringValue; 92 @property (nonatomic, getter=getCounterValue, readonly) BOOL counterValue; 93 @property (nonatomic, getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary; 94 95 - (BOOL)is3bar; // watch out 96 - (NSString *)get3foo; // watch out 97 98 @property (nonatomic, getter=getM, readonly) BOOL m; 99 @property (nonatomic, getter=getMA, readonly) BOOL MA; 100 @property (nonatomic, getter=getALL, readonly) BOOL ALL; 101 @property (nonatomic, getter=getMANY, readonly) BOOL MANY; 102 @property (nonatomic, getter=getSome, readonly) BOOL some; 103 @end 104 105 106 @interface NSInvocation(CAT) 107 @property (nonatomic, assign) id target; 108 109 @property (nonatomic, assign) id dataSource; 110 111 @property (nonatomic, assign) id xxxdelegateYYY; 112 113 114 @property (nonatomic, strong) id MYtarget; 115 116 @property (nonatomic, strong) id targetX; 117 118 @property (nonatomic) int value; 119 120 @property (nonatomic, getter=isContinuous) BOOL continuous; 121 122 - (id) isAnObject; 123 - (void)setAnObject : (id) object; 124 125 @property (nonatomic, getter=isinValid, readonly) BOOL inValid; 126 - (void) setInValid : (BOOL) arg; 127 128 - (void) Nothing; 129 @property (nonatomic, readonly) int Length; 130 @property (nonatomic, readonly, strong) id object; 131 + (double) D; 132 133 - (BOOL)is3bar; // watch out 134 - (NSString *)get3foo; // watch out 135 136 @property (nonatomic, getter=getM, readonly) BOOL m; 137 @property (nonatomic, getter=getMA, readonly) BOOL MA; 138 @property (nonatomic, getter=getALL, readonly) BOOL ALL; 139 @property (nonatomic, getter=getMANY, readonly) BOOL MANY; 140 @property (nonatomic, getter=getSome, readonly) BOOL some; 141 @end 142 143 DEPRECATED 144 @interface I_DEP 145 - (BOOL) isinValid; 146 - (void) setInValid : (BOOL) arg; 147 @end 148 149 @interface AnotherOne 150 - (BOOL) isinValid DEPRECATED; 151 - (void) setInValid : (BOOL) arg; 152 - (id)MYtarget; 153 - (void)setMYtarget: (id)target DEPRECATED; 154 - (BOOL) getM DEPRECATED; 155 156 - (id)xxxdelegateYYY DEPRECATED; 157 - (void)setXxxdelegateYYY:(id)delegate DEPRECATED; 158 @end 159 160 // rdar://14987909 161 #define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0))) 162 #define NORETURN __attribute__((noreturn)) 163 #define ALIGNED __attribute__((aligned(16))) 164 165 @interface NSURL 166 // Do not infer a property. 167 @property (nonatomic, strong) NSURL *appStoreReceiptURL NS_AVAILABLE; 168 - (void) setAppStoreReceiptURL : (NSURL *)object; 169 170 @property (nonatomic, strong) NSURL *appStoreReceiptURLX NS_AVAILABLE; 171 172 // Do not infer a property. 173 @property (nonatomic, strong) NSURL *appStoreReceiptURLY ; 174 - (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE; 175 176 @property (nonatomic, readonly, strong) id OkToInfer NS_AVAILABLE; 177 178 // Do not infer a property. 179 @property (nonatomic, strong) NSURL *appStoreReceiptURLZ ; 180 - (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE; 181 182 // Do not infer a property. 183 - (id) t1 NORETURN NS_AVAILABLE; 184 - (void) setT1 : (id) arg NS_AVAILABLE; 185 186 @property (nonatomic, strong) id method1 ALIGNED NS_AVAILABLE; 187 188 - (NSURL *)init; // No Change 189 + (id)alloc; // No Change 190 191 - (BOOL)is1stClass; // Not a valid property 192 @property (nonatomic, getter=isClass, readonly) BOOL class; // This is a valid property 'class' is not a keyword in ObjC 193 - (BOOL)isDouble; // Not a valid property 194 195 @end 196 197 // rdar://15082818 198 @class NSMutableDictionary; 199 200 @interface NSArray 201 @property (nonatomic, readonly, copy) id (^expressionBlock)(id, NSArray *, NSMutableDictionary *); 202 @property (nonatomic, copy) id (^MyBlock)(id, NSArray *, NSMutableDictionary *); 203 @property (nonatomic, readonly) id (*expressionFuncptr)(id, NSArray *, NSMutableDictionary *); 204 @property (nonatomic) id (*MyFuncptr)(id, NSArray *, NSMutableDictionary *); 205 @end 206 207 // rdar://15231241 208 @interface rdar15231241 209 @property (nonatomic, readonly) double Ddelegate; 210 @property (nonatomic, readonly) float Fdelegate; 211 @property (nonatomic, readonly) int Idelegate; 212 @property (nonatomic, readonly) BOOL Bdelegate; 213 @end 214 215 // rdar://19372798 216 @protocol NSObject @end 217 @protocol MyProtocol <NSObject> 218 @property (nonatomic, readonly, strong) id readonlyProperty; 219 @property (nonatomic, strong) id readWriteProperty; 220 @end 221