ObjectiveC migrator. Change naming hueristic for

deprecated categories, fixes a typo reported by
Jordan.

llvm-svn: 193759
This commit is contained in:
Fariborz Jahanian 2013-10-31 16:10:44 +00:00
parent d29853564d
commit d41dbadacd
3 changed files with 20 additions and 6 deletions

View 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);

View File

@ -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

View File

@ -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