From c1cc488c3cf9ce7f7b7e211e891e2be7391e0e5a Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 27 Aug 2013 23:56:54 +0000 Subject: [PATCH] ObjectiveC migrator: minor refactoring of my last cf annotation patch. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189420 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/ARCMigrate/ObjCMT.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/ARCMigrate/ObjCMT.cpp b/lib/ARCMigrate/ObjCMT.cpp index 4fa4b1e660..56a042f7ff 100644 --- a/lib/ARCMigrate/ObjCMT.cpp +++ b/lib/ARCMigrate/ObjCMT.cpp @@ -57,9 +57,9 @@ class ObjCMigrateASTConsumer : public ASTConsumer { void migrateCFAnnotation(ASTContext &Ctx, const Decl *Decl); void AddCFAnnotations(ASTContext &Ctx, const CallEffects &CE, - const FunctionDecl *FuncDecl); + const FunctionDecl *FuncDecl, bool ResultAnnotated); void AddCFAnnotations(ASTContext &Ctx, const CallEffects &CE, - const ObjCMethodDecl *MethodDecl); + const ObjCMethodDecl *MethodDecl, bool ResultAnnotated); void AnnotateImplicitBridging(ASTContext &Ctx); @@ -868,10 +868,10 @@ void ObjCMigrateASTConsumer::migrateCFAnnotation(ASTContext &Ctx, const Decl *De void ObjCMigrateASTConsumer::AddCFAnnotations(ASTContext &Ctx, const CallEffects &CE, - const FunctionDecl *FuncDecl) { + const FunctionDecl *FuncDecl, + bool ResultAnnotated) { // Annotate function. - if (!FuncDecl->getAttr() && - !FuncDecl->getAttr()) { + if (!ResultAnnotated) { RetEffect Ret = CE.getReturnValue(); const char *AnnotationString = 0; if (Ret.getObjKind() == RetEffect::CF && Ret.isOwned()) { @@ -947,7 +947,7 @@ ObjCMigrateASTConsumer::CF_BRIDGING_KIND else { QualType AT = pd->getType(); if (!AuditedType(AT)) { - AddCFAnnotations(Ctx, CE, FuncDecl); + AddCFAnnotations(Ctx, CE, FuncDecl, FuncIsReturnAnnotated); return CF_BRIDGING_NONE; } } @@ -974,10 +974,10 @@ void ObjCMigrateASTConsumer::migrateARCSafeAnnotation(ASTContext &Ctx, void ObjCMigrateASTConsumer::AddCFAnnotations(ASTContext &Ctx, const CallEffects &CE, - const ObjCMethodDecl *MethodDecl) { + const ObjCMethodDecl *MethodDecl, + bool ResultAnnotated) { // Annotate function. - if (!MethodDecl->getAttr() && - !MethodDecl->getAttr()) { + if (!ResultAnnotated) { RetEffect Ret = CE.getReturnValue(); const char *AnnotationString = 0; if (Ret.getObjKind() == RetEffect::CF && Ret.isOwned()) { @@ -1052,7 +1052,7 @@ ObjCMigrateASTConsumer::CF_BRIDGING_KIND else { QualType AT = pd->getType(); if (!AuditedType(AT)) { - AddCFAnnotations(Ctx, CE, MethodDecl); + AddCFAnnotations(Ctx, CE, MethodDecl, MethodIsReturnAnnotated); return CF_BRIDGING_NONE; } } -- 2.40.0