r193759 - ObjectiveC migrator. Change naming hueristic for

Fariborz Jahanian fjahanian at apple.com
Thu Oct 31 09:10:45 PDT 2013


Author: fjahanian
Date: Thu Oct 31 11:10:44 2013
New Revision: 193759

URL: http://llvm.org/viewvc/llvm-project?rev=193759&view=rev
Log:
ObjectiveC migrator. Change naming hueristic for
deprecated categories, fixes a typo reported by
Jordan.

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

Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=193759&r1=193758&r2=193759&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Thu Oct 31 11:10:44 2013
@@ -44,7 +44,7 @@ class ObjCMigrateASTConsumer : public AS
   
   void migrateDecl(Decl *D);
   void migrateObjCInterfaceDecl(ASTContext &Ctx, ObjCContainerDecl *D);
-  void migregateDeprecatedAnnotation(ASTContext &Ctx, ObjCCategoryDecl *CatDecl);
+  void migrateDeprecatedAnnotation(ASTContext &Ctx, ObjCCategoryDecl *CatDecl);
   void migrateProtocolConformance(ASTContext &Ctx,
                                   const ObjCImplementationDecl *ImpDecl);
   void CacheObjCNSIntegerTypedefed(const TypedefDecl *TypedefDcl);
@@ -425,10 +425,10 @@ void ObjCMigrateASTConsumer::migrateObjC
   }
 }
 
-void ObjCMigrateASTConsumer::migregateDeprecatedAnnotation(ASTContext &Ctx,
+void ObjCMigrateASTConsumer::migrateDeprecatedAnnotation(ASTContext &Ctx,
                                                            ObjCCategoryDecl *CatDecl) {
   StringRef Name = CatDecl->getName();
-  if (!Name.startswith("NS") || !Name.endswith("Deprecated"))
+  if (!Name.endswith("Deprecated"))
     return;
   
   if (!Ctx.Idents.get("DEPRECATED").hasMacroDefinition())
@@ -1541,7 +1541,7 @@ void ObjCMigrateASTConsumer::HandleTrans
       if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(*D)) {
         migrateObjCInterfaceDecl(Ctx, CatDecl);
         if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
-          migregateDeprecatedAnnotation(Ctx, CatDecl);
+          migrateDeprecatedAnnotation(Ctx, CatDecl);
       }
       else if (ObjCProtocolDecl *PDecl = dyn_cast<ObjCProtocolDecl>(*D))
         ObjCProtocolDecls.insert(PDecl);

Modified: cfe/trunk/test/ARCMT/objcmt-deprecated-category.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-deprecated-category.m?rev=193759&r1=193758&r2=193759&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-deprecated-category.m (original)
+++ cfe/trunk/test/ARCMT/objcmt-deprecated-category.m Thu Oct 31 11:10:44 2013
@@ -39,3 +39,10 @@
 @property int P2 DEPRECATED;
 
 @end
+
+ at interface NSArray (Deprecated)
+- (void)getObjects:(id __unsafe_unretained [])objects;
+- (void)dep_getObjects:(id __unsafe_unretained [])dep_objects DEPRECATED;
+ at property int P1;
+ at property int P2 DEPRECATED;
+ at end

Modified: cfe/trunk/test/ARCMT/objcmt-deprecated-category.m.result
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/objcmt-deprecated-category.m.result?rev=193759&r1=193758&r2=193759&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/objcmt-deprecated-category.m.result (original)
+++ cfe/trunk/test/ARCMT/objcmt-deprecated-category.m.result Thu Oct 31 11:10:44 2013
@@ -33,9 +33,16 @@
 
 /* This method is unsafe because it could potentially cause buffer overruns. You should use -getObjects:range: instead.
 */
-- (void)getObjects:(id __unsafe_unretained [])objects;
+- (void)getObjects:(id __unsafe_unretained [])objects DEPRECATED;
 - (void)dep_getObjects:(id __unsafe_unretained [])dep_objects DEPRECATED;
- at property int P1;
+ at property int P1 DEPRECATED;
 @property int P2 DEPRECATED;
 
 @end
+
+ at interface NSArray (Deprecated)
+- (void)getObjects:(id __unsafe_unretained [])objects DEPRECATED;
+- (void)dep_getObjects:(id __unsafe_unretained [])dep_objects DEPRECATED;
+ at property int P1 DEPRECATED;
+ at property int P2 DEPRECATED;
+ at end





More information about the cfe-commits mailing list