r187008 - ObjectiveC migration: more migration to

Fariborz Jahanian fjahanian at apple.com
Tue Jul 23 16:55:55 PDT 2013


Author: fjahanian
Date: Tue Jul 23 18:55:55 2013
New Revision: 187008

URL: http://llvm.org/viewvc/llvm-project?rev=187008&view=rev
Log:
ObjectiveC migration: more migration to
instancetype of NSDictionary methods.

Modified:
    cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
    cfe/trunk/test/ARCMT/objcmt-instancetype.m.result

Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=187008&r1=187007&r2=187008&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Jul 23 18:55:55 2013
@@ -557,8 +557,14 @@ void ObjCMigrateASTConsumer::migrateMeth
   if (OIT_Family == OIT_None)
     return;
   // TODO. Many more to come
-  if (OIT_Family != OIT_Array)
-    return;
+  switch (OIT_Family) {
+    case OIT_Array:
+      break;
+    case OIT_Dictionary:
+      break;
+    default:
+      return;
+  }
   if (!OM->getResultType()->isObjCIdType())
     return;
   
@@ -569,7 +575,14 @@ void ObjCMigrateASTConsumer::migrateMeth
     else if (ObjCImplDecl *ImpDecl = dyn_cast<ObjCImplDecl>(CDecl))
       IDecl = ImpDecl->getClassInterface();
   }
-  if (!IDecl || !IDecl->lookupInheritedClass(&Ctx.Idents.get("NSArray")))
+  if (!IDecl)
+    return;
+  
+  if (OIT_Family ==  OIT_Array &&
+      !IDecl->lookupInheritedClass(&Ctx.Idents.get("NSArray")))
+    return;
+  else if (OIT_Family == OIT_Dictionary &&
+           !IDecl->lookupInheritedClass(&Ctx.Idents.get("NSDictionary")))
     return;
   
   TypeSourceInfo *TSInfo =  OM->getResultTypeSourceInfo();

Modified: cfe/trunk/test/ARCMT/objcmt-instancetype.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-instancetype.m.result?rev=187008&r1=187007&r2=187008&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-instancetype.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-instancetype.m.result Tue Jul 23 18:55:55 2013
@@ -44,12 +44,12 @@ typedef signed char BOOL;
 @end
 
 @interface NSDictionary (NSDictionaryCreation)
-+ (id)dictionary;
-+ (id)dictionaryWithObject:(id)object forKey:(id)key;
-+ (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
-+ (id)dictionaryWithObjectsAndKeys:(id)firstObject, ...;
-+ (id)dictionaryWithDictionary:(NSDictionary *)dict;
-+ (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
++ (instancetype)dictionary;
++ (instancetype)dictionaryWithObject:(id)object forKey:(id)key;
++ (instancetype)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
++ (instancetype)dictionaryWithObjectsAndKeys:(id)firstObject, ...;
++ (instancetype)dictionaryWithDictionary:(NSDictionary *)dict;
++ (instancetype)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
 
 - (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt;
 - (id)initWithObjectsAndKeys:(id)firstObject, ...;





More information about the cfe-commits mailing list