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