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