aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-25 01:21:50 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-25 01:21:50 +0000
commit4da0427a20f31db9b6934b280d49ab264236b34c (patch)
treedbd2bde50ac02b1976711fed609a444a654303c7 /lib/Analysis/CFRefCount.cpp
parentc62a2fe1957626bc4b29402b2d0a3694dfaa3280 (diff)
Hook up attribute 'objc_ownership_retain' to the analyzer. This attribute allows
users to specify that a method's argument is visibly retained (reference count incremented). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70008 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index 9080e66876..bb957b89f5 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1095,7 +1095,18 @@ RetainSummaryManager::getMethodSummaryFromAnnotations(ObjCMethodDecl *MD) {
}
}
- if (!hasRetEffect)
+ // Determine if there are any arguments with a specific ArgEffect.
+ bool hasArgEffect = false;
+ unsigned i = 0;
+ for (ObjCMethodDecl::param_iterator I = MD->param_begin(),
+ E = MD->param_end(); I != E; ++I, ++i) {
+ if ((*I)->getAttr<ObjCOwnershipRetainAttr>()) {
+ ScratchArgs.push_back(std::make_pair(i, IncRefMsg));
+ hasArgEffect = true;
+ }
+}
+
+ if (!hasRetEffect && !hasArgEffect)
return 0;
return getPersistentSummary(RE);