r189420 - ObjectiveC migrator: minor refactoring of my last

Fariborz Jahanian fjahanian at apple.com
Tue Aug 27 16:56:55 PDT 2013


Author: fjahanian
Date: Tue Aug 27 18:56:54 2013
New Revision: 189420

URL: http://llvm.org/viewvc/llvm-project?rev=189420&view=rev
Log:
ObjectiveC migrator: minor refactoring of my last
cf annotation patch.

Modified:
    cfe/trunk/lib/ARCMigrate/ObjCMT.cpp

Modified: cfe/trunk/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ObjCMT.cpp?rev=189420&r1=189419&r2=189420&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ObjCMT.cpp Tue Aug 27 18:56:54 2013
@@ -57,9 +57,9 @@ class ObjCMigrateASTConsumer : public AS
   
   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::migrateCFAn
 
 void ObjCMigrateASTConsumer::AddCFAnnotations(ASTContext &Ctx,
                                               const CallEffects &CE,
-                                              const FunctionDecl *FuncDecl) {
+                                              const FunctionDecl *FuncDecl,
+                                              bool ResultAnnotated) {
   // Annotate function.
-  if (!FuncDecl->getAttr<CFReturnsRetainedAttr>() &&
-      !FuncDecl->getAttr<CFReturnsNotRetainedAttr>()) {
+  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::migrateARCS
 
 void ObjCMigrateASTConsumer::AddCFAnnotations(ASTContext &Ctx,
                                               const CallEffects &CE,
-                                              const ObjCMethodDecl *MethodDecl) {
+                                              const ObjCMethodDecl *MethodDecl,
+                                              bool ResultAnnotated) {
   // Annotate function.
-  if (!MethodDecl->getAttr<CFReturnsRetainedAttr>() &&
-      !MethodDecl->getAttr<CFReturnsNotRetainedAttr>()) {
+  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;
       }
     }





More information about the cfe-commits mailing list