summaryrefslogtreecommitdiffstats
path: root/clang/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
commite75de954088bc795c7a88b975f18daf3685040ce (patch)
treee8742beada3230f73ff59b36b0e28741fd94b27b /clang/lib/Analysis/CFRefCount.cpp
parentf005eac566a3b6e506d6437305805907ed4313d7 (diff)
downloadbcm5719-llvm-e75de954088bc795c7a88b975f18daf3685040ce.tar.gz
bcm5719-llvm-e75de954088bc795c7a88b975f18daf3685040ce.zip
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). llvm-svn: 70008
Diffstat (limited to 'clang/lib/Analysis/CFRefCount.cpp')
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index 9080e668764..bb957b89f55 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/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);
OpenPOWER on IntegriCloud