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