diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-07-06 18:30:43 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-07-06 18:30:43 +0000 |
commit | 6d4b76d93cbc5ad05af4cd2815c86febbfd5e798 (patch) | |
tree | 8dd59ca26819ecb8c9b070e88760a3bfe466adb5 /lib/Analysis/CFRefCount.cpp | |
parent | 675431d5a8b6aed1bd7322aa2da5cd8eb0ae76b7 (diff) |
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
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index c8919c38cb..d3d0545e99 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/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* |