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
diff --git a/lib/StaticAnalyzer/CFRefCount.cpp b/lib/StaticAnalyzer/CFRefCount.cpp
index 473b731..546687a 100644
--- a/lib/StaticAnalyzer/CFRefCount.cpp
+++ b/lib/StaticAnalyzer/CFRefCount.cpp
@@ -467,6 +467,10 @@
/// 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 @@
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>()) {