From: Fariborz Jahanian Date: Wed, 3 Jul 2013 23:44:11 +0000 (+0000) Subject: Minor refactoring of my last patch. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dca7289799517c3eee1765a174984f2ecffad0f1;p=clang Minor refactoring of my last patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185593 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index 8f56648b07..8702ac3f8f 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -193,32 +193,30 @@ void ObjCMigrateASTConsumer::migrateObjCInterfaceDecl(ASTContext &Ctx, for (ObjCContainerDecl::method_iterator M = D->meth_begin(), MEnd = D->meth_end(); M != MEnd; ++M) { ObjCMethodDecl *Method = (*M); - if (Method->isPropertyAccessor()) + if (Method->isPropertyAccessor() || Method->param_size() != 0) continue; // Is this method candidate to be a getter? - if (Method->param_size() == 0) { - QualType GRT = Method->getResultType(); - if (GRT->isVoidType()) + QualType GRT = Method->getResultType(); + if (GRT->isVoidType()) + continue; + Selector GetterSelector = Method->getSelector(); + IdentifierInfo *getterName = GetterSelector.getIdentifierInfoForSlot(0); + Selector SetterSelector = + SelectorTable::constructSetterSelector(PP.getIdentifierTable(), + PP.getSelectorTable(), + getterName); + if (ObjCMethodDecl *SetterMethod = D->lookupMethod(SetterSelector, true)) { + // Is this a valid setter, matching the target getter? + QualType SRT = SetterMethod->getResultType(); + 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; - Selector GetterSelector = Method->getSelector(); - IdentifierInfo *getterName = GetterSelector.getIdentifierInfoForSlot(0); - Selector SetterSelector = - SelectorTable::constructSetterSelector(PP.getIdentifierTable(), - PP.getSelectorTable(), - getterName); - if (ObjCMethodDecl *SetterMethod = D->lookupMethod(SetterSelector, true)) { - // Is this a valid setter, matching the target getter? - QualType SRT = SetterMethod->getResultType(); - 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; - // we have a matching setter/getter pair. - // TODO. synthesize a suitable property declaration here. + // we have a matching setter/getter pair. + // TODO. synthesize a suitable property declaration here. } - } } }