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