summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-06 18:30:43 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-06 18:30:43 +0000
commit0578e4386296e7c59efe99499af6878f33ff3bb4 (patch)
tree54490993dca9d352145bac738f0687fa4791d2e6 /clang/lib/Analysis/CFRefCount.cpp
parent0774820306e1991dc804d3409fc225e40a240ad3 (diff)
downloadbcm5719-llvm-0578e4386296e7c59efe99499af6878f33ff3bb4.tar.gz
bcm5719-llvm-0578e4386296e7c59efe99499af6878f33ff3bb4.zip
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.
llvm-svn: 74841
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index c8919c38cb5..d3d0545e99c 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/lib/Analysis/CFRefCount.cpp
@@ -1267,15 +1267,23 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ,
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*
OpenPOWER on IntegriCloud