diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-01-27 06:54:14 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-01-27 06:54:14 +0000 |
commit | 12b9434d5bf801e24242b1f6fd04899f8a7fa92c (patch) | |
tree | 0ec00000d3d8b704bc4ed229fec30fa3b64b1865 /lib/StaticAnalyzer/CFRefCount.cpp | |
parent | eb7a779365c08f8f363e679a9f9fa389f22c7982 (diff) |
Hook up attribute ns_consumes_self in the ObjC retain/release checker in the static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/CFRefCount.cpp')
-rw-r--r-- | lib/StaticAnalyzer/CFRefCount.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/CFRefCount.cpp b/lib/StaticAnalyzer/CFRefCount.cpp index 473b7313bb..546687a7a2 100644 --- a/lib/StaticAnalyzer/CFRefCount.cpp +++ b/lib/StaticAnalyzer/CFRefCount.cpp @@ -467,6 +467,10 @@ public: /// terminate the path. bool isEndPath() const { return EndPath; } + + /// Sets the effect on the receiver of the message. + void setReceiverEffect(ArgEffect e) { Receiver = e; } + /// getReceiverEffect - Returns the effect on the receiver of the call. /// This is only meaningful if the summary applies to an ObjCMessageExpr*. ArgEffect getReceiverEffect() const { return Receiver; } @@ -1219,6 +1223,11 @@ RetainSummaryManager::updateSummaryFromAnnotations(RetainSummary &Summ, bool isTrackedLoc = false; + // Effects on the receiver. + if (MD->getAttr<NSConsumesSelfAttr>()) { + Summ.setReceiverEffect(DecRefMsg); + } + // Determine if there is a special return effect for this method. if (cocoa::isCocoaObjectRef(MD->getResultType())) { if (MD->getAttr<NSReturnsRetainedAttr>()) { |