<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Both <span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">DecRefAndStopTracking and </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">DecRefMsgAndStopTracking</span> were not covered by tests. This probably tests only one of them, right?<div>Anna.<br><div><div>On Aug 20, 2012, at 1:01 PM, Jordan Rose wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Author: jrose<br>Date: Mon Aug 20 15:01:15 2012<br>New Revision: 162221<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=162221&view=rev">http://llvm.org/viewvc/llvm-project?rev=162221&view=rev</a><br>Log:<br>[analyzer] Add a test for "release and stop tracking" behavior.<br><br>This is used to handle functions and methods that consume an argument<br>(annotated with the ns_consumed or cf_consumed attribute), but then the<br>argument's retain count may be further modified in a callback. We want<br>to warn about over-releasing, but we can't really track the object afterwards.<br><br>Modified:<br>    cfe/trunk/test/Analysis/retain-release.m<br><br>Modified: cfe/trunk/test/Analysis/retain-release.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=162221&r1=162220&r2=162221&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=162221&r1=162220&r2=162221&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Analysis/retain-release.m (original)<br>+++ cfe/trunk/test/Analysis/retain-release.m Mon Aug 20 15:01:15 2012<br>@@ -1855,3 +1855,17 @@<br>   [objCObject release]; // +1<br>   return [objCObject autorelease]; // +0<br> }<br>+<br>+void consumeAndStopTracking(id NS_CONSUMED obj, void (^callback)(void));<br>+void testConsumeAndStopTracking() {<br>+  id retained = [@[] retain]; // +1<br>+  consumeAndStopTracking(retained, ^{}); // no-warning<br>+<br>+  id doubleRetained = [[@[] retain] retain]; // +2<br>+  consumeAndStopTracking(doubleRetained, ^{<br>+    [doubleRetained release];<br>+  }); // no-warning<br>+<br>+  id unretained = @[]; // +0<br>+  consumeAndStopTracking(unretained, ^{}); // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}}<br>+}<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></div></blockquote></div><br></div></body></html>