From: Fariborz Jahanian Date: Thu, 31 Oct 2013 16:10:44 +0000 (+0000) Subject: ObjectiveC migrator. Change naming hueristic for X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5eeefe6cfd4c31fe6af0f1abfe4e78f294faa982;p=clang ObjectiveC migrator. Change naming hueristic for 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 --- diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index b2a6980944..f6cc19a737 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -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(*D)) { migrateObjCInterfaceDecl(Ctx, CatDecl); if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation) - migregateDeprecatedAnnotation(Ctx, CatDecl); + migrateDeprecatedAnnotation(Ctx, CatDecl); } else if (ObjCProtocolDecl *PDecl = dyn_cast(*D)) ObjCProtocolDecls.insert(PDecl); diff --git a/test/ARCMT/objcmt-deprecated-category.m b/test/ARCMT/objcmt-deprecated-category.m index 0b7c1cf1bd..5939e5a50a 100644 --- a/test/ARCMT/objcmt-deprecated-category.m +++ b/test/ARCMT/objcmt-deprecated-category.m @@ -39,3 +39,10 @@ @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 diff --git a/test/ARCMT/objcmt-deprecated-category.m.result b/test/ARCMT/objcmt-deprecated-category.m.result index 4d2a6b64de..3cb100044e 100644 --- a/test/ARCMT/objcmt-deprecated-category.m.result +++ b/test/ARCMT/objcmt-deprecated-category.m.result @@ -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; -@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