r195292 - ObjectiveC migrator. use strong instead of
Fariborz Jahanian
fjahanian at apple.com
Wed Nov 20 16:58:17 PST 2013
Author: fjahanian
Date: Wed Nov 20 18:58:17 2013
New Revision: 195292
URL: http://llvm.org/viewvc/llvm-project?rev=195292&view=rev
Log:
ObjectiveC migrator. use strong instead of
retain attribute for inferred properties.
// rdar://15519923
Modified:
cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result
cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result
cfe/trunk/test/ARCMT/objcmt-property-availability.m.result
cfe/trunk/test/ARCMT/objcmt-property.m.result
Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=195292&r1=195291&r2=195292&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Nov 20 18:58:17 2013
@@ -301,7 +301,7 @@ static const char *PropertyMemoryAttribu
IDecl->lookupNestedProtocol(&Context.Idents.get("NSCopying")))
return "copy";
else
- return "retain";
+ return "strong";
}
else if (ArgType->isBlockPointerType())
return "copy";
@@ -310,7 +310,7 @@ static const char *PropertyMemoryAttribu
// looking into setter's implementation for backing weak ivar.
return "weak";
else if (RetainableObject)
- return ArgType->isBlockPointerType() ? "copy" : "retain";
+ return ArgType->isBlockPointerType() ? "copy" : "strong";
return 0;
}
Modified: cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result?rev=195292&r1=195291&r2=195292&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-atomic-property.m.result Wed Nov 20 18:58:17 2013
@@ -23,14 +23,14 @@ typedef char BOOL;
}
@property (weak) NSString *WeakProp;
- at property (retain) NSString *StrongProp;
+ at property (strong) NSString *StrongProp;
- at property (retain) NSString *UnavailProp __attribute__((unavailable));
+ at property (strong) NSString *UnavailProp __attribute__((unavailable));
- (void) setUnavailProp : (NSString *)Val;
- at property (retain) NSString *UnavailProp1 __attribute__((unavailable));
+ at property (strong) NSString *UnavailProp1 __attribute__((unavailable));
- at property (retain) NSString *UnavailProp2;
+ at property (strong) NSString *UnavailProp2;
- (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable));
@property (copy) NSDictionary *undoAction;
@@ -48,10 +48,10 @@ typedef char BOOL;
NSArray *_names3;
NSArray *_names4;
}
- at property (retain) NSArray *names2;
- at property (retain) NSArray *names3;
- at property (retain) NSArray *names4;
- at property (retain) NSArray *names1;
+ at property (strong) NSArray *names2;
+ at property (strong) NSArray *names3;
+ at property (strong) NSArray *names4;
+ at property (strong) NSArray *names1;
@end
// Properties that contain the name "delegate" or "dataSource",
@@ -64,9 +64,9 @@ typedef char BOOL;
@property (assign) id xxxdelegateYYY;
- at property (retain) id MYtarget;
+ at property (strong) id MYtarget;
- at property (retain) id targetX;
+ at property (strong) id targetX;
@property int value;
@@ -80,14 +80,14 @@ typedef char BOOL;
- (void) Nothing;
@property (readonly) int Length;
- at property (readonly, retain) id object;
+ at property (readonly, strong) id object;
+ (double) D;
@property (readonly) void *JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
@property (getter=isIgnoringInteractionEvents, readonly) BOOL ignoringInteractionEvents;
- at property (getter=getStringValue, retain) NSString *stringValue;
+ at property (getter=getStringValue, strong) NSString *stringValue;
@property (getter=getCounterValue, readonly) BOOL counterValue;
- at property (getter=getns_dixtionary, readonly, retain) NSDictionary *ns_dixtionary;
+ at property (getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out
@@ -108,9 +108,9 @@ typedef char BOOL;
@property (assign) id xxxdelegateYYY;
- at property (retain) id MYtarget;
+ at property (strong) id MYtarget;
- at property (retain) id targetX;
+ at property (strong) id targetX;
@property int value;
@@ -124,7 +124,7 @@ typedef char BOOL;
- (void) Nothing;
@property (readonly) int Length;
- at property (readonly, retain) id object;
+ at property (readonly, strong) id object;
+ (double) D;
- (BOOL)is3bar; // watch out
@@ -161,26 +161,26 @@ DEPRECATED
@interface NSURL
// Do not infer a property.
- at property (retain) NSURL *appStoreReceiptURL NS_AVAILABLE;
+ at property (strong) NSURL *appStoreReceiptURL NS_AVAILABLE;
- (void) setAppStoreReceiptURL : (NSURL *)object;
- at property (retain) NSURL *appStoreReceiptURLX NS_AVAILABLE;
+ at property (strong) NSURL *appStoreReceiptURLX NS_AVAILABLE;
// Do not infer a property.
- at property (retain) NSURL *appStoreReceiptURLY ;
+ at property (strong) NSURL *appStoreReceiptURLY ;
- (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
- at property (readonly, retain) id OkToInfer NS_AVAILABLE;
+ at property (readonly, strong) id OkToInfer NS_AVAILABLE;
// Do not infer a property.
- at property (retain) NSURL *appStoreReceiptURLZ ;
+ at property (strong) NSURL *appStoreReceiptURLZ ;
- (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
// Do not infer a property.
- (id) t1 NORETURN NS_AVAILABLE;
- (void) setT1 : (id) arg NS_AVAILABLE;
- at property (retain) id method1 ALIGNED NS_AVAILABLE;
+ at property (strong) id method1 ALIGNED NS_AVAILABLE;
- (NSURL *)init; // No Change
+ (id)alloc; // No Change
Modified: cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result?rev=195292&r1=195291&r2=195292&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-ns-nonatomic-iosonly.m.result Wed Nov 20 18:58:17 2013
@@ -30,14 +30,14 @@ typedef char BOOL;
}
@property (NS_NONATOMIC_IOSONLY, weak) NSString *WeakProp;
- at property (NS_NONATOMIC_IOSONLY, retain) NSString *StrongProp;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSString *StrongProp;
- at property (NS_NONATOMIC_IOSONLY, retain) NSString *UnavailProp __attribute__((unavailable));
+ at property (NS_NONATOMIC_IOSONLY, strong) NSString *UnavailProp __attribute__((unavailable));
- (void) setUnavailProp : (NSString *)Val;
- at property (NS_NONATOMIC_IOSONLY, retain) NSString *UnavailProp1 __attribute__((unavailable));
+ at property (NS_NONATOMIC_IOSONLY, strong) NSString *UnavailProp1 __attribute__((unavailable));
- at property (NS_NONATOMIC_IOSONLY, retain) NSString *UnavailProp2;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSString *UnavailProp2;
- (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable));
@property (NS_NONATOMIC_IOSONLY, copy) NSDictionary *undoAction;
@@ -55,10 +55,10 @@ typedef char BOOL;
NSArray *_names3;
NSArray *_names4;
}
- at property (NS_NONATOMIC_IOSONLY, retain) NSArray *names2;
- at property (NS_NONATOMIC_IOSONLY, retain) NSArray *names3;
- at property (NS_NONATOMIC_IOSONLY, retain) NSArray *names4;
- at property (NS_NONATOMIC_IOSONLY, retain) NSArray *names1;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSArray *names2;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSArray *names3;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSArray *names4;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSArray *names1;
@end
// Properties that contain the name "delegate" or "dataSource",
@@ -71,9 +71,9 @@ typedef char BOOL;
@property (NS_NONATOMIC_IOSONLY, assign) id xxxdelegateYYY;
- at property (NS_NONATOMIC_IOSONLY, retain) id MYtarget;
+ at property (NS_NONATOMIC_IOSONLY, strong) id MYtarget;
- at property (NS_NONATOMIC_IOSONLY, retain) id targetX;
+ at property (NS_NONATOMIC_IOSONLY, strong) id targetX;
@property (NS_NONATOMIC_IOSONLY) int value;
@@ -87,14 +87,14 @@ typedef char BOOL;
- (void) Nothing;
@property (NS_NONATOMIC_IOSONLY, readonly) int Length;
- at property (NS_NONATOMIC_IOSONLY, readonly, retain) id object;
+ at property (NS_NONATOMIC_IOSONLY, readonly, strong) id object;
+ (double) D;
@property (NS_NONATOMIC_IOSONLY, readonly) void *JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
@property (NS_NONATOMIC_IOSONLY, getter=isIgnoringInteractionEvents, readonly) BOOL ignoringInteractionEvents;
- at property (NS_NONATOMIC_IOSONLY, getter=getStringValue, retain) NSString *stringValue;
+ at property (NS_NONATOMIC_IOSONLY, getter=getStringValue, strong) NSString *stringValue;
@property (NS_NONATOMIC_IOSONLY, getter=getCounterValue, readonly) BOOL counterValue;
- at property (NS_NONATOMIC_IOSONLY, getter=getns_dixtionary, readonly, retain) NSDictionary *ns_dixtionary;
+ at property (NS_NONATOMIC_IOSONLY, getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out
@@ -115,9 +115,9 @@ typedef char BOOL;
@property (NS_NONATOMIC_IOSONLY, assign) id xxxdelegateYYY;
- at property (NS_NONATOMIC_IOSONLY, retain) id MYtarget;
+ at property (NS_NONATOMIC_IOSONLY, strong) id MYtarget;
- at property (NS_NONATOMIC_IOSONLY, retain) id targetX;
+ at property (NS_NONATOMIC_IOSONLY, strong) id targetX;
@property (NS_NONATOMIC_IOSONLY) int value;
@@ -131,7 +131,7 @@ typedef char BOOL;
- (void) Nothing;
@property (NS_NONATOMIC_IOSONLY, readonly) int Length;
- at property (NS_NONATOMIC_IOSONLY, readonly, retain) id object;
+ at property (NS_NONATOMIC_IOSONLY, readonly, strong) id object;
+ (double) D;
- (BOOL)is3bar; // watch out
@@ -168,26 +168,26 @@ DEPRECATED
@interface NSURL
// Do not infer a property.
- at property (NS_NONATOMIC_IOSONLY, retain) NSURL *appStoreReceiptURL NS_AVAILABLE;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSURL *appStoreReceiptURL NS_AVAILABLE;
- (void) setAppStoreReceiptURL : (NSURL *)object;
- at property (NS_NONATOMIC_IOSONLY, retain) NSURL *appStoreReceiptURLX NS_AVAILABLE;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSURL *appStoreReceiptURLX NS_AVAILABLE;
// Do not infer a property.
- at property (NS_NONATOMIC_IOSONLY, retain) NSURL *appStoreReceiptURLY ;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSURL *appStoreReceiptURLY ;
- (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
- at property (NS_NONATOMIC_IOSONLY, readonly, retain) id OkToInfer NS_AVAILABLE;
+ at property (NS_NONATOMIC_IOSONLY, readonly, strong) id OkToInfer NS_AVAILABLE;
// Do not infer a property.
- at property (NS_NONATOMIC_IOSONLY, retain) NSURL *appStoreReceiptURLZ ;
+ at property (NS_NONATOMIC_IOSONLY, strong) NSURL *appStoreReceiptURLZ ;
- (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
// Do not infer a property.
- (id) t1 NORETURN NS_AVAILABLE;
- (void) setT1 : (id) arg NS_AVAILABLE;
- at property (NS_NONATOMIC_IOSONLY, retain) id method1 ALIGNED NS_AVAILABLE;
+ at property (NS_NONATOMIC_IOSONLY, strong) id method1 ALIGNED NS_AVAILABLE;
- (NSURL *)init; // No Change
+ (id)alloc; // No Change
Modified: cfe/trunk/test/ARCMT/objcmt-property-availability.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property-availability.m.result?rev=195292&r1=195291&r2=195292&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property-availability.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property-availability.m.result Wed Nov 20 18:58:17 2013
@@ -19,20 +19,20 @@
#define UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
@interface MKMapItem
- at property (nonatomic, retain) MKMapItem *source NS_AVAILABLE(10_9, 6_0);
+ at property (nonatomic, strong) MKMapItem *source NS_AVAILABLE(10_9, 6_0);
- (void)setSource:(MKMapItem *)source NS_AVAILABLE(10_9, 7_0);
- at property (nonatomic, retain) MKMapItem *dest NS_AVAILABLE(10_9, 6_0);
+ at property (nonatomic, strong) MKMapItem *dest NS_AVAILABLE(10_9, 6_0);
- at property (nonatomic, retain) MKMapItem *final;
+ at property (nonatomic, strong) MKMapItem *final;
- at property (nonatomic, retain) MKMapItem *total NS_AVAILABLE(10_9, 6_0);
+ at property (nonatomic, strong) MKMapItem *total NS_AVAILABLE(10_9, 6_0);
- (void)setTotal:(MKMapItem *)source;
- (MKMapItem *)comp NS_AVAILABLE(10_9, 6_0);
- (void)setComp:(MKMapItem *)source UNAVAILABLE;
- at property (nonatomic, retain) MKMapItem *tally UNAVAILABLE NS_AVAILABLE(10_9, 6_0);
+ at property (nonatomic, strong) MKMapItem *tally UNAVAILABLE NS_AVAILABLE(10_9, 6_0);
- (MKMapItem *)itally NS_AVAILABLE(10_9, 6_0);
- (void)setItally:(MKMapItem *)source UNAVAILABLE NS_AVAILABLE(10_9, 6_0);
Modified: cfe/trunk/test/ARCMT/objcmt-property.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-property.m.result?rev=195292&r1=195291&r2=195292&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-property.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-property.m.result Wed Nov 20 18:58:17 2013
@@ -23,14 +23,14 @@ typedef char BOOL;
}
@property (nonatomic, weak) NSString *WeakProp;
- at property (nonatomic, retain) NSString *StrongProp;
+ at property (nonatomic, strong) NSString *StrongProp;
- at property (nonatomic, retain) NSString *UnavailProp __attribute__((unavailable));
+ at property (nonatomic, strong) NSString *UnavailProp __attribute__((unavailable));
- (void) setUnavailProp : (NSString *)Val;
- at property (nonatomic, retain) NSString *UnavailProp1 __attribute__((unavailable));
+ at property (nonatomic, strong) NSString *UnavailProp1 __attribute__((unavailable));
- at property (nonatomic, retain) NSString *UnavailProp2;
+ at property (nonatomic, strong) NSString *UnavailProp2;
- (void) setUnavailProp2 : (NSString *)Val __attribute__((unavailable));
@property (nonatomic, copy) NSDictionary *undoAction;
@@ -48,10 +48,10 @@ typedef char BOOL;
NSArray *_names3;
NSArray *_names4;
}
- at property (nonatomic, retain) NSArray *names2;
- at property (nonatomic, retain) NSArray *names3;
- at property (nonatomic, retain) NSArray *names4;
- at property (nonatomic, retain) NSArray *names1;
+ at property (nonatomic, strong) NSArray *names2;
+ at property (nonatomic, strong) NSArray *names3;
+ at property (nonatomic, strong) NSArray *names4;
+ at property (nonatomic, strong) NSArray *names1;
@end
// Properties that contain the name "delegate" or "dataSource",
@@ -64,9 +64,9 @@ typedef char BOOL;
@property (nonatomic, assign) id xxxdelegateYYY;
- at property (nonatomic, retain) id MYtarget;
+ at property (nonatomic, strong) id MYtarget;
- at property (nonatomic, retain) id targetX;
+ at property (nonatomic, strong) id targetX;
@property (nonatomic) int value;
@@ -80,14 +80,14 @@ typedef char BOOL;
- (void) Nothing;
@property (nonatomic, readonly) int Length;
- at property (nonatomic, readonly, retain) id object;
+ at property (nonatomic, readonly, strong) id object;
+ (double) D;
@property (nonatomic, readonly) void *JSObject WEBKIT_OBJC_METHOD_ANNOTATION(AVAILABLE_WEBKIT_VERSION_3_0_AND_LATER);
@property (nonatomic, getter=isIgnoringInteractionEvents, readonly) BOOL ignoringInteractionEvents;
- at property (nonatomic, getter=getStringValue, retain) NSString *stringValue;
+ at property (nonatomic, getter=getStringValue, strong) NSString *stringValue;
@property (nonatomic, getter=getCounterValue, readonly) BOOL counterValue;
- at property (nonatomic, getter=getns_dixtionary, readonly, retain) NSDictionary *ns_dixtionary;
+ at property (nonatomic, getter=getns_dixtionary, readonly, strong) NSDictionary *ns_dixtionary;
- (BOOL)is3bar; // watch out
- (NSString *)get3foo; // watch out
@@ -108,9 +108,9 @@ typedef char BOOL;
@property (nonatomic, assign) id xxxdelegateYYY;
- at property (nonatomic, retain) id MYtarget;
+ at property (nonatomic, strong) id MYtarget;
- at property (nonatomic, retain) id targetX;
+ at property (nonatomic, strong) id targetX;
@property (nonatomic) int value;
@@ -124,7 +124,7 @@ typedef char BOOL;
- (void) Nothing;
@property (nonatomic, readonly) int Length;
- at property (nonatomic, readonly, retain) id object;
+ at property (nonatomic, readonly, strong) id object;
+ (double) D;
- (BOOL)is3bar; // watch out
@@ -161,26 +161,26 @@ DEPRECATED
@interface NSURL
// Do not infer a property.
- at property (nonatomic, retain) NSURL *appStoreReceiptURL NS_AVAILABLE;
+ at property (nonatomic, strong) NSURL *appStoreReceiptURL NS_AVAILABLE;
- (void) setAppStoreReceiptURL : (NSURL *)object;
- at property (nonatomic, retain) NSURL *appStoreReceiptURLX NS_AVAILABLE;
+ at property (nonatomic, strong) NSURL *appStoreReceiptURLX NS_AVAILABLE;
// Do not infer a property.
- at property (nonatomic, retain) NSURL *appStoreReceiptURLY ;
+ at property (nonatomic, strong) NSURL *appStoreReceiptURLY ;
- (void) setAppStoreReceiptURLY : (NSURL *)object NS_AVAILABLE;
- at property (nonatomic, readonly, retain) id OkToInfer NS_AVAILABLE;
+ at property (nonatomic, readonly, strong) id OkToInfer NS_AVAILABLE;
// Do not infer a property.
- at property (nonatomic, retain) NSURL *appStoreReceiptURLZ ;
+ at property (nonatomic, strong) NSURL *appStoreReceiptURLZ ;
- (void) setAppStoreReceiptURLZ : (NSURL *)object NS_AVAILABLE;
// Do not infer a property.
- (id) t1 NORETURN NS_AVAILABLE;
- (void) setT1 : (id) arg NS_AVAILABLE;
- at property (nonatomic, retain) id method1 ALIGNED NS_AVAILABLE;
+ at property (nonatomic, strong) id method1 ALIGNED NS_AVAILABLE;
- (NSURL *)init; // No Change
+ (id)alloc; // No Change
More information about the cfe-commits
mailing list