Fix <rdar://problem/7033733>.  The CF_RETURNS_RETAINED attribute should work if the return type on an Objective-C method is a CF type reference, not just an Objective-C object reference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74841 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index c8919c3..d3d0545 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1267,15 +1267,23 @@
   if (!MD)
     return;
 
+  bool isTrackedLoc = false;
+  
   // Determine if there is a special return effect for this method.
   if (isTrackedObjCObjectType(MD->getResultType())) {
     if (MD->getAttr<NSReturnsRetainedAttr>()) {
       Summ.setRetEffect(ObjCAllocRetE);
+      return;
     }
-    else if (MD->getAttr<CFReturnsRetainedAttr>()) {
-      Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
-    }
+    
+    isTrackedLoc = true;
   }
+  
+  if (!isTrackedLoc)
+    isTrackedLoc = MD->getResultType()->getAsPointerType() != NULL;
+    
+  if (isTrackedLoc && MD->getAttr<CFReturnsRetainedAttr>())
+    Summ.setRetEffect(RetEffect::MakeOwned(RetEffect::CF, true));
 }
 
 RetainSummary*