]> granicus.if.org Git - clang/commitdiff
ObjectiveC migrator. delegate property must be
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 21 Nov 2013 17:49:34 +0000 (17:49 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 21 Nov 2013 17:49:34 +0000 (17:49 +0000)
inferred as 'assign', not 'assign' and 'strong'.
// rdar://15509831

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

lib/ARCMigrate/ObjCMT.cpp
test/ARCMT/objcmt-property.m
test/ARCMT/objcmt-property.m.result

index f35e981d94e4aa828858f3f9a4af9e3f4e4b9ab3..ac423c2f26834a2bf14de7c17a3f24725d5845b3 100644 (file)
@@ -343,12 +343,9 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter,
     PropertyString += PropertyNameString;
   }
   // Property with no setter may be suggested as a 'readonly' property.
-  if (!Setter) {
+  if (!Setter)
     append_attr(PropertyString, "readonly", LParenAdded);
-    QualType ResType = Context.getCanonicalType(Getter->getResultType());
-    if (const char *MemoryManagementAttr = PropertyMemoryAttribute(Context, ResType))
-      append_attr(PropertyString, MemoryManagementAttr, LParenAdded);
-  }
+  
   
   // Short circuit 'delegate' properties that contain the name "delegate" or
   // "dataSource", or have exact name "target" to have 'assign' attribute.
@@ -358,8 +355,11 @@ static void rewriteToObjCProperty(const ObjCMethodDecl *Getter,
     QualType QT = Getter->getResultType();
     if (!QT->isRealType())
       append_attr(PropertyString, "assign", LParenAdded);
-  }
-  else if (Setter) {
+  } else if (!Setter) {
+    QualType ResType = Context.getCanonicalType(Getter->getResultType());
+    if (const char *MemoryManagementAttr = PropertyMemoryAttribute(Context, ResType))
+      append_attr(PropertyString, MemoryManagementAttr, LParenAdded);
+  } else {
     const ParmVarDecl *argDecl = *Setter->param_begin();
     QualType ArgType = Context.getCanonicalType(argDecl->getType());
     if (const char *MemoryManagementAttr = PropertyMemoryAttribute(Context, ArgType))
index 3b77aadb892bc85adbb792f7f411ec6cc538f67d..61739efe0ab2edc77badd855d180cdc1477a836f 100644 (file)
@@ -70,6 +70,9 @@ typedef char BOOL;
 
 - (id) dataSource;
 
+// rdar://15509831
+- (id)delegate;
+
 - (id)xxxdelegateYYY;
 - (void)setXxxdelegateYYY:(id)delegate;
 
index 1a82cb20525e0a268a00fdfd103ab4fbd3a4e301..eb2f5fea908991e60ab8e65a9d8dceb99161b298 100644 (file)
@@ -61,6 +61,9 @@ typedef char BOOL;
 
 @property (nonatomic, assign) id dataSource;
 
+// rdar://15509831
+@property (nonatomic, readonly, assign) id delegate;
+
 @property (nonatomic, assign) id xxxdelegateYYY;