r185593 - Minor refactoring of my last patch.

Fariborz Jahanian fjahanian at apple.com
Wed Jul 3 16:44:11 PDT 2013


Author: fjahanian
Date: Wed Jul  3 18:44:11 2013
New Revision: 185593

URL: http://llvm.org/viewvc/llvm-project?rev=185593&view=rev
Log:
Minor refactoring of my last patch.

Modified:
    cfe/trunk/lib/ARCMigrate/ObjCMT.cpp

Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=185593&r1=185592&r2=185593&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Wed Jul  3 18:44:11 2013
@@ -193,32 +193,30 @@ void ObjCMigrateASTConsumer::migrateObjC
   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.
       }
-    }
   }
 }
 





More information about the cfe-commits mailing list