Home | History | Annotate | Download | only in ARCMT
      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 - (void) setWeakProp : (NSString *__weak)Val;
     25 - (NSString *__weak) WeakProp;
     26 
     27 - (NSString *) StrongProp;
     28 - (void) setStrongProp : (NSString *)Val;
     29 
     30 - (NSString *) UnavailProp  __attribute__((unavailable));
     31 - (void) setUnavailProp  : (NSString *)Val;
     32 
     33 - (NSString *) UnavailProp1  __attribute__((unavailable));
     34 - (void) setUnavailProp1  : (NSString *)Val  __attribute__((unavailable));
     35 
     36 - (NSString *) UnavailProp2;
     37 - (void) setUnavailProp2  : (NSString *)Val  __attribute__((unavailable));
     38 
     39 - (NSDictionary*) undoAction;
     40 - (void) setUndoAction: (NSDictionary*)Arg;
     41 @end
     42 
     43 @implementation I
     44 @end
     45 
     46 @class NSArray;
     47 
     48 @interface MyClass2  {
     49 @private
     50     NSArray *_names1;
     51     NSArray *_names2;
     52     NSArray *_names3;
     53     NSArray *_names4;
     54 }
     55 - (void)setNames1:(NSArray *)names;
     56 - (void)setNames4:(__strong NSArray *)names;
     57 - (void)setNames3:(__strong NSArray *)names;
     58 - (void)setNames2:(NSArray *)names;
     59 - (NSArray *) names2;
     60 - (NSArray *)names3;
     61 - (__strong NSArray *)names4;
     62 - (NSArray *) names1;
     63 @end
     64 
     65 // Properties that contain the name "delegate" or "dataSource",
     66 // or have exact name "target" have unsafe_unretained attribute.
     67 @interface NSInvocation 
     68 - (id)target;
     69 - (void)setTarget:(id)target;
     70 
     71 - (id) dataSource;
     72 
     73 // rdar://15509831
     74 - (id)delegate;
     75 
     76 - (id)xxxdelegateYYY;
     77 - (void)setXxxdelegateYYY:(id)delegate;
     78 
     79 - (void)setDataSource:(id)source;
     80 
     81 - (id)MYtarget;
     82 - (void)setMYtarget: (id)target;
     83 
     84 - (id)targetX;
     85 - (void)setTargetX: (id)t;
     86  
     87 - (int)value;
     88 - (void)setValue: (int)val;
     89 
     90 -(BOOL) isContinuous;
     91 -(void) setContinuous:(BOOL)value;
     92 
     93 - (id) isAnObject;
     94 - (void)setAnObject : (id) object;
     95 
     96 - (BOOL) isinValid;
     97 - (void) setInValid : (BOOL) arg;
     98 
     99 - (void) Nothing;
    100 - (int) Length;
    101 - (id) object;
    102 + (double) D;
    103 - (void *)JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
    104 - (BOOL)isIgnoringInteractionEvents;
    105 
    106 - (NSString *)getStringValue;
    107 - (BOOL)getCounterValue;
    108 - (void)setStringValue:(NSString *)stringValue AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER;
    109 - (NSDictionary *)getns_dixtionary;
    110 
    111 - (BOOL)is3bar; // watch out
    112 - (NSString *)get3foo; // watch out
    113 
    114 - (BOOL) getM;
    115 - (BOOL) getMA;
    116 - (BOOL) getALL;
    117 - (BOOL) getMANY;
    118 - (BOOL) getSome;
    119 @end
    120 
    121 
    122 @interface NSInvocation(CAT)
    123 - (id)target;
    124 - (void)setTarget:(id)target;
    125 
    126 - (id) dataSource;
    127 
    128 - (id)xxxdelegateYYY;
    129 - (void)setXxxdelegateYYY:(id)delegate;
    130 
    131 - (void)setDataSource:(id)source;
    132 
    133 - (id)MYtarget;
    134 - (void)setMYtarget: (id)target;
    135 
    136 - (id)targetX;
    137 - (void)setTargetX: (id)t;
    138 
    139 - (int)value;
    140 - (void)setValue: (int)val;
    141 
    142 -(BOOL) isContinuous;
    143 -(void) setContinuous:(BOOL)value;
    144 
    145 - (id) isAnObject;
    146 - (void)setAnObject : (id) object;
    147 
    148 - (BOOL) isinValid;
    149 - (void) setInValid : (BOOL) arg;
    150 
    151 - (void) Nothing;
    152 - (int) Length;
    153 - (id) object;
    154 + (double) D;
    155 
    156 - (BOOL)is3bar; // watch out
    157 - (NSString *)get3foo; // watch out
    158 
    159 - (BOOL) getM;
    160 - (BOOL) getMA;
    161 - (BOOL) getALL;
    162 - (BOOL) getMANY;
    163 - (BOOL) getSome;
    164 @end
    165 
    166 DEPRECATED
    167 @interface I_DEP
    168 - (BOOL) isinValid;
    169 - (void) setInValid : (BOOL) arg;
    170 @end
    171 
    172 @interface AnotherOne
    173 - (BOOL) isinValid DEPRECATED;
    174 - (void) setInValid : (BOOL) arg;
    175 - (id)MYtarget;
    176 - (void)setMYtarget: (id)target DEPRECATED;
    177 - (BOOL) getM DEPRECATED;
    178 
    179 - (id)xxxdelegateYYY DEPRECATED;
    180 - (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
    181 @end
    182 
    183 // rdar://14987909
    184 #define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
    185 #define NORETURN __attribute__((noreturn))
    186 #define ALIGNED __attribute__((aligned(16)))
    187 
    188 @interface NSURL
    189 // Do not infer a property.
    190 - (NSURL *)appStoreReceiptURL NS_AVAILABLE;
    191 - (void) setAppStoreReceiptURL : (NSURL *)object;
    192 
    193 - (NSURL *)appStoreReceiptURLX NS_AVAILABLE;
    194 - (void) setAppStoreReceiptURLX : (NSURL *)object NS_AVAILABLE;
    195 
    196 // Do not infer a property.
    197 - (NSURL *)appStoreReceiptURLY ;
    198 - (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
    199 
    200 - (id)OkToInfer NS_AVAILABLE;
    201 
    202 // Do not infer a property.
    203 - (NSURL *)appStoreReceiptURLZ ;
    204 - (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
    205 
    206 // Do not infer a property.
    207 - (id) t1 NORETURN NS_AVAILABLE;
    208 - (void) setT1 : (id) arg NS_AVAILABLE;
    209 
    210 - (id)method1 ALIGNED NS_AVAILABLE;
    211 - (void) setMethod1 : (id) object NS_AVAILABLE ALIGNED;
    212 
    213 - (NSURL *)init;  // No Change
    214 + (id)alloc;      // No Change
    215 
    216 - (BOOL)is1stClass; // Not a valid property
    217 - (BOOL)isClass;    // This is a valid property 'class' is not a keyword in ObjC
    218 - (BOOL)isDouble; // Not a valid property
    219 
    220 @end
    221 
    222 // rdar://15082818
    223 @class NSMutableDictionary;
    224 
    225 @interface NSArray
    226 - (id (^)(id, NSArray *, NSMutableDictionary *)) expressionBlock;
    227 - (id (^)(id, NSArray *, NSMutableDictionary *)) MyBlock;
    228 - (void) setMyBlock : (id (^)(id, NSArray *, NSMutableDictionary *)) bl;
    229 - (id (*)(id, NSArray *, NSMutableDictionary *)) expressionFuncptr;
    230 - (id (*)(id, NSArray *, NSMutableDictionary *)) MyFuncptr;
    231 - (void) setMyFuncptr : (id (*)(id, NSArray *, NSMutableDictionary *)) bl;
    232 @end
    233 
    234 // rdar://15231241
    235 @interface rdar15231241
    236 @property (nonatomic, readonly) double Ddelegate;
    237 @property (nonatomic, readonly) float Fdelegate;
    238 @property (nonatomic, readonly) int Idelegate;
    239 @property (nonatomic, readonly) BOOL Bdelegate;
    240 @end
    241 
    242 // rdar://19372798
    243 @protocol NSObject @end
    244 @protocol MyProtocol <NSObject>
    245 - (id)readonlyProperty;
    246 - (id)readWriteProperty;
    247 - (void)setReadWriteProperty:(id)readWriteProperty;
    248 @end
    249