ObjectiveC migrator. Use 'assign' for 'delegate'
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 16 Oct 2013 18:52:17 +0000 (18:52 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 16 Oct 2013 18:52:17 +0000 (18:52 +0000)
properties. // rdar://15231860

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192826 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ARCMigrate/ObjCMT.cpp
test/ARCMT/objcmt-arc-cf-annotations.m.result
test/ARCMT/objcmt-atomic-property.m.result
test/ARCMT/objcmt-property.m.result

index 3801ca571508d5d5d99100194debf3c126088e4b..65825cea27855ab16c6a6de2f05ff103532a7f93 100644 (file)
@@ -285,12 +285,12 @@ static bool rewriteToObjCProperty(const ObjCMethodDecl *Getter,
   if (!Setter)
     append_attr(PropertyString, "readonly");
   
-  // Short circuit properties that contain the name "delegate" or "dataSource",
-  // or have exact name "target" to have unsafe_unretained attribute.
+  // Short circuit 'delegate' properties that contain the name "delegate" or
+  // "dataSource", or have exact name "target" to have 'assign' attribute.
   if (PropertyName.equals("target") ||
       (PropertyName.find("delegate") != StringRef::npos) ||
       (PropertyName.find("dataSource") != StringRef::npos))
-    append_attr(PropertyString, "unsafe_unretained");
+    append_attr(PropertyString, "assign");
   else if (Setter) {
     const ParmVarDecl *argDecl = *Setter->param_begin();
     QualType ArgType = Context.getCanonicalType(argDecl->getType());
index 1963d832ac0c0c4f33fb4b6c8d413ef94ab3010b..949016a8977807feb9441245f95e9cd94a8ccf60 100644 (file)
@@ -2090,6 +2090,6 @@ CFAttributedStringRef CFAttributedCreate(void *CFObj CF_CONSUMED) CF_RETURNS_RET
 @interface Action
 @property (nonatomic) SEL action;
 
-@property (nonatomic, unsafe_unretained) id target;
+@property (nonatomic, assign) id target;
 
 @end
index 620ae39a00dd9458e0161507d49e2921ebde15d6..2bebf4a46f3932d41ad37e7bd85344c37a7d4d82 100644 (file)
@@ -65,12 +65,12 @@ typedef char BOOL;
 // Properties that contain the name "delegate" or "dataSource",
 // or have exact name "target" have unsafe_unretained attribute.
 @interface NSInvocation 
-@property (atomic, unsafe_unretained) id target;
+@property (atomic, assign) id target;
 
 
-@property (atomic, unsafe_unretained) id dataSource;
+@property (atomic, assign) id dataSource;
 
-@property (atomic, unsafe_unretained) id xxxdelegateYYY;
+@property (atomic, assign) id xxxdelegateYYY;
 
 
 
@@ -117,12 +117,12 @@ typedef char BOOL;
 
 
 @interface NSInvocation(CAT)
-@property (atomic, unsafe_unretained) id target;
+@property (atomic, assign) id target;
 
 
-@property (atomic, unsafe_unretained) id dataSource;
+@property (atomic, assign) id dataSource;
 
-@property (atomic, unsafe_unretained) id xxxdelegateYYY;
+@property (atomic, assign) id xxxdelegateYYY;
 
 
 
index bd9b38bd48434270eaa6659bf3225e0590459cbe..4379be6e00c248361eddbdddf490effffca6721c 100644 (file)
@@ -65,12 +65,12 @@ typedef char BOOL;
 // Properties that contain the name "delegate" or "dataSource",
 // or have exact name "target" have unsafe_unretained attribute.
 @interface NSInvocation 
-@property (nonatomic, unsafe_unretained) id target;
+@property (nonatomic, assign) id target;
 
 
-@property (nonatomic, unsafe_unretained) id dataSource;
+@property (nonatomic, assign) id dataSource;
 
-@property (nonatomic, unsafe_unretained) id xxxdelegateYYY;
+@property (nonatomic, assign) id xxxdelegateYYY;
 
 
 
@@ -117,12 +117,12 @@ typedef char BOOL;
 
 
 @interface NSInvocation(CAT)
-@property (nonatomic, unsafe_unretained) id target;
+@property (nonatomic, assign) id target;
 
 
-@property (nonatomic, unsafe_unretained) id dataSource;
+@property (nonatomic, assign) id dataSource;
 
-@property (nonatomic, unsafe_unretained) id xxxdelegateYYY;
+@property (nonatomic, assign) id xxxdelegateYYY;