diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-04-25 01:21:50 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-04-25 01:21:50 +0000 |
commit | e75de954088bc795c7a88b975f18daf3685040ce (patch) | |
tree | e8742beada3230f73ff59b36b0e28741fd94b27b /clang/lib/Analysis/CFRefCount.cpp | |
parent | f005eac566a3b6e506d6437305805907ed4313d7 (diff) | |
download | bcm5719-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.cpp | 13 |
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); |