diff --git a/clang/lib/ARCMigrate/ObjCMT.cpp b/clang/lib/ARCMigrate/ObjCMT.cpp index b2a6980944d7..f6cc19a73788 100644 --- a/clang/lib/ARCMigrate/ObjCMT.cpp +++ b/clang/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/clang/test/ARCMT/objcmt-deprecated-category.m b/clang/test/ARCMT/objcmt-deprecated-category.m index 0b7c1cf1bdaa..5939e5a50ada 100644 --- a/clang/test/ARCMT/objcmt-deprecated-category.m +++ b/clang/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/clang/test/ARCMT/objcmt-deprecated-category.m.result b/clang/test/ARCMT/objcmt-deprecated-category.m.result index 4d2a6b64de8b..3cb100044e46 100644 --- a/clang/test/ARCMT/objcmt-deprecated-category.m.result +++ b/clang/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