]> granicus.if.org Git - clang/commitdiff
[ObjectiveC migrator] relax the rules for setter/getter
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 4 Jul 2013 00:24:32 +0000 (00:24 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 4 Jul 2013 00:24:32 +0000 (00:24 +0000)
types when deciding on validity of a property
inclusion. // rdar://14345082

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

lib/ARCMigrate/ObjCMT.cpp

index 8702ac3f8f969180e78ead8c7aa09be9e52fb948..696666ecde774be7a81827c7139d77f6d595472d 100644 (file)
@@ -211,9 +211,14 @@ void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx,
       if (!SRT->isVoidType())
         continue;
       const ParmVarDecl *argDecl = *SetterMethod->param_begin();
-      // FIXME. Can relax rule for matching getter/setter type further.
-      if (!Ctx.hasSameType(argDecl->getType(), GRT))
-        continue;
+      QualType ArgType = argDecl->getType();
+      if (!Ctx.hasSameType(ArgType, GRT)) {
+        bool Valid =
+          ((GRT->isObjCIdType() && ArgType->isObjCObjectPointerType())
+            || (ArgType->isObjCIdType() && GRT->isObjCObjectPointerType()));
+        if (!Valid)
+          continue;
+      }
       // we have a matching setter/getter pair.
       // TODO. synthesize a suitable property declaration here.
       }