]> granicus.if.org Git - clang/commitdiff
ObjectiveC migrator. Change naming hueristic for
authorFariborz Jahanian <fjahanian@apple.com>
Thu, 31 Oct 2013 16:10:44 +0000 (16:10 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Thu, 31 Oct 2013 16:10:44 +0000 (16:10 +0000)
deprecated categories, fixes a typo reported by
Jordan.

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

lib/ARCMigrate/ObjCMT.cpp
test/ARCMT/objcmt-deprecated-category.m
test/ARCMT/objcmt-deprecated-category.m.result

index b2a6980944d77773009ae705e3f781ef52e5a0bf..f6cc19a73788a99adffa63383a55d47af0920446 100644 (file)
@@ -44,7 +44,7 @@ class ObjCMigrateASTConsumer : public ASTConsumer {
   
   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::migrateObjCInterfaceDecl(ASTContext &Ctx,
   }
 }
 
-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::HandleTranslationUnit(ASTContext &Ctx) {
       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);
index 0b7c1cf1bdaaf32b79054f0ff5279cbb1616f5f2..5939e5a50ada0e3834c3340a74ebdc5813076c94 100644 (file)
 @property int P2 DEPRECATED;
 
 @end
+
+@interface NSArray (Deprecated)
+- (void)getObjects:(id __unsafe_unretained [])objects;
+- (void)dep_getObjects:(id __unsafe_unretained [])dep_objects DEPRECATED;
+@property int P1;
+@property int P2 DEPRECATED;
+@end
index 4d2a6b64de8b44c083b09d1588130c5a2b4bad3d..3cb100044e4694cc5554404691cb2489f08ea12c 100644 (file)
 
 /* 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;
-@property int P1;
+@property int P1 DEPRECATED;
 @property int P2 DEPRECATED;
 
 @end
+
+@interface NSArray (Deprecated)
+- (void)getObjects:(id __unsafe_unretained [])objects DEPRECATED;
+- (void)dep_getObjects:(id __unsafe_unretained [])dep_objects DEPRECATED;
+@property int P1 DEPRECATED;
+@property int P2 DEPRECATED;
+@end