const ObjCImplementationDecl *ImpDecl);
void migrateNSEnumDecl(ASTContext &Ctx, const EnumDecl *EnumDcl,
const TypedefDecl *TypedefDcl);
- void migrateMethods(ASTContext &Ctx, ObjCContainerDecl *CDecl);
+ void migrateAllMethodInstaceType(ASTContext &Ctx, ObjCContainerDecl *CDecl);
void migrateMethodInstanceType(ASTContext &Ctx, ObjCContainerDecl *CDecl,
ObjCMethodDecl *OM);
bool migrateProperty(ASTContext &Ctx, ObjCContainerDecl *D, ObjCMethodDecl *OM);
if (Method->isDeprecated())
continue;
migrateProperty(Ctx, D, Method);
- migrateNsReturnsInnerPointer(Ctx, Method);
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
+ migrateNsReturnsInnerPointer(Ctx, Method);
}
for (ObjCContainerDecl::prop_iterator P = D->prop_begin(),
E = D->prop_end(); P != E; ++P) {
ObjCPropertyDecl *Prop = *P;
- if (!P->isDeprecated())
+ if ((ASTMigrateActions & FrontendOptions::ObjCMT_Annotation) &&
+ !P->isDeprecated())
migratePropertyNsReturnsInnerPointer(Ctx, Prop);
}
}
Editor->commit(commit);
}
-void ObjCMigrateASTConsumer::migrateMethods(ASTContext &Ctx,
+void ObjCMigrateASTConsumer::migrateAllMethodInstaceType(ASTContext &Ctx,
ObjCContainerDecl *CDecl) {
if (CDecl->isDeprecated())
return;
D != DEnd; ++D) {
if (unsigned FID =
PP.getSourceManager().getFileID((*D)->getLocation()).getHashValue())
- if (FileId && FileId != FID)
- AnnotateImplicitBridging(Ctx);
-
+ if (FileId && FileId != FID) {
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
+ AnnotateImplicitBridging(Ctx);
+ }
+
if (ObjCInterfaceDecl *CDecl = dyn_cast<ObjCInterfaceDecl>(*D))
migrateObjCInterfaceDecl(Ctx, CDecl);
if (ObjCCategoryDecl *CatDecl = dyn_cast<ObjCCategoryDecl>(*D))
else if (ObjCProtocolDecl *PDecl = dyn_cast<ObjCProtocolDecl>(*D))
ObjCProtocolDecls.insert(PDecl);
else if (const ObjCImplementationDecl *ImpDecl =
- dyn_cast<ObjCImplementationDecl>(*D))
- migrateProtocolConformance(Ctx, ImpDecl);
+ dyn_cast<ObjCImplementationDecl>(*D)) {
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_ProtocolConformance)
+ migrateProtocolConformance(Ctx, ImpDecl);
+ }
else if (const EnumDecl *ED = dyn_cast<EnumDecl>(*D)) {
DeclContext::decl_iterator N = D;
++N;
if (N != DEnd)
- if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*N))
- migrateNSEnumDecl(Ctx, ED, TD);
+ if (const TypedefDecl *TD = dyn_cast<TypedefDecl>(*N)) {
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_NsMacros)
+ migrateNSEnumDecl(Ctx, ED, TD);
+ }
+ }
+ else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*D)) {
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
+ migrateCFAnnotation(Ctx, FD);
}
- else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(*D))
- migrateCFAnnotation(Ctx, FD);
if (ObjCContainerDecl *CDecl = dyn_cast<ObjCContainerDecl>(*D)) {
// migrate methods which can have instancetype as their result type.
- migrateMethods(Ctx, CDecl);
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_Instancetype)
+ migrateAllMethodInstaceType(Ctx, CDecl);
// annotate methods with CF annotations.
- migrateARCSafeAnnotation(Ctx, CDecl);
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
+ migrateARCSafeAnnotation(Ctx, CDecl);
}
}
- AnnotateImplicitBridging(Ctx);
+ if (ASTMigrateActions & FrontendOptions::ObjCMT_Annotation)
+ AnnotateImplicitBridging(Ctx);
}
Rewriter rewriter(Ctx.getSourceManager(), Ctx.getLangOpts());