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 -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 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 (weak) NSString *WeakProp;
     25 
     26 @property (strong) NSString *StrongProp;
     27 
     28 @property (strong) NSString *UnavailProp  __attribute__((unavailable));
     29 - (void) setUnavailProp  : (NSString *)Val;
     30 
     31 @property (strong) NSString *UnavailProp1  __attribute__((unavailable));
     32 
     33 @property (strong) NSString *UnavailProp2;
     34 - (void) setUnavailProp2  : (NSString *)Val  __attribute__((unavailable));
     35 
     36 @property (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 (strong) NSArray *names2;
     52 @property (strong) NSArray *names3;
     53 @property (strong) NSArray *names4;
     54 @property (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 (assign) id target;
     61 
     62 @property (assign) id dataSource;
     63 
     64 @property (assign) id xxxdelegateYYY;
     65 
     66 
     67 @property (strong) id MYtarget;
     68 
     69 @property (strong) id targetX;
     70  
     71 @property  int value;
     72 
     73 @property (getter=isContinuous) BOOL continuous;
     74 
     75 - (id) isAnObject;
     76 - (void)setAnObject : (id) object;
     77 
     78 @property (getter=isinValid, readonly) BOOL inValid;
     79 - (void) setInValid : (BOOL) arg;
     80 
     81 - (void) Nothing;
     82 @property (readonly) int Length;
     83 @property (readonly, strong) id object;
     84 + (double) D;
     85 @property (readonly) void *JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
     86 @property (getter=isIgnoringInteractionEvents, readonly) BOOL ignoringInteractionEvents;
     87 
     88 @property (getter=getStringValue, strong) NSString *stringValue;
     89 @property (getter=getCounterValue, readonly) BOOL counterValue;
     90 @property (getter=getns_dixtionary, readonly, copy) NSDictionary *ns_dixtionary;
     91 
     92 - (BOOL)is3bar; // watch out
     93 - (NSString *)get3foo; // watch out
     94 
     95 @property (getter=getM, readonly) BOOL m;
     96 @property (getter=getMA, readonly) BOOL MA;
     97 @property (getter=getALL, readonly) BOOL ALL;
     98 @property (getter=getMANY, readonly) BOOL MANY;
     99 @property (getter=getSome, readonly) BOOL some;
    100 @end
    101 
    102 
    103 @interface NSInvocation(CAT)
    104 @property (assign) id target;
    105 
    106 @property (assign) id dataSource;
    107 
    108 @property (assign) id xxxdelegateYYY;
    109 
    110 
    111 @property (strong) id MYtarget;
    112 
    113 @property (strong) id targetX;
    114 
    115 @property  int value;
    116 
    117 @property (getter=isContinuous) BOOL continuous;
    118 
    119 - (id) isAnObject;
    120 - (void)setAnObject : (id) object;
    121 
    122 @property (getter=isinValid, readonly) BOOL inValid;
    123 - (void) setInValid : (BOOL) arg;
    124 
    125 - (void) Nothing;
    126 @property (readonly) int Length;
    127 @property (readonly, strong) id object;
    128 + (double) D;
    129 
    130 - (BOOL)is3bar; // watch out
    131 - (NSString *)get3foo; // watch out
    132 
    133 @property (getter=getM, readonly) BOOL m;
    134 @property (getter=getMA, readonly) BOOL MA;
    135 @property (getter=getALL, readonly) BOOL ALL;
    136 @property (getter=getMANY, readonly) BOOL MANY;
    137 @property (getter=getSome, readonly) BOOL some;
    138 @end
    139 
    140 DEPRECATED
    141 @interface I_DEP
    142 - (BOOL) isinValid;
    143 - (void) setInValid : (BOOL) arg;
    144 @end
    145 
    146 @interface AnotherOne
    147 - (BOOL) isinValid DEPRECATED;
    148 - (void) setInValid : (BOOL) arg;
    149 - (id)MYtarget;
    150 - (void)setMYtarget: (id)target DEPRECATED;
    151 - (BOOL) getM DEPRECATED;
    152 
    153 - (id)xxxdelegateYYY DEPRECATED;
    154 - (void)setXxxdelegateYYY:(id)delegate DEPRECATED;
    155 @end
    156 
    157 // rdar://14987909
    158 #define NS_AVAILABLE __attribute__((availability(macosx,introduced=10.0)))
    159 #define NORETURN __attribute__((noreturn))
    160 #define ALIGNED __attribute__((aligned(16)))
    161 
    162 @interface NSURL
    163 // Do not infer a property.
    164 @property (strong) NSURL *appStoreReceiptURL NS_AVAILABLE;
    165 - (void) setAppStoreReceiptURL : (NSURL *)object;
    166 
    167 @property (strong) NSURL *appStoreReceiptURLX NS_AVAILABLE;
    168 
    169 // Do not infer a property.
    170 @property (strong) NSURL *appStoreReceiptURLY ;
    171 - (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
    172 
    173 @property (readonly, strong) id OkToInfer NS_AVAILABLE;
    174 
    175 // Do not infer a property.
    176 @property (strong) NSURL *appStoreReceiptURLZ ;
    177 - (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
    178 
    179 // Do not infer a property.
    180 - (id) t1 NORETURN NS_AVAILABLE;
    181 - (void) setT1 : (id) arg NS_AVAILABLE;
    182 
    183 @property (strong) id method1 ALIGNED NS_AVAILABLE;
    184 
    185 - (NSURL *)init;  // No Change
    186 + (id)alloc;      // No Change
    187 
    188 - (BOOL)is1stClass; // Not a valid property
    189 @property (getter=isClass, readonly) BOOL class;    // This is a valid property 'class' is not a keyword in ObjC
    190 - (BOOL)isDouble; // Not a valid property
    191 
    192 @end
    193 
    194 // rdar://15082818
    195 @class NSMutableDictionary;
    196 
    197 @interface NSArray
    198 @property (readonly, copy) id (^expressionBlock)(id, NSArray *, NSMutableDictionary *);
    199 @property (copy) id (^MyBlock)(id, NSArray *, NSMutableDictionary *);
    200 @property (readonly) id (*expressionFuncptr)(id, NSArray *, NSMutableDictionary *);
    201 @property  id (*MyFuncptr)(id, NSArray *, NSMutableDictionary *);
    202 @end
    203