Fix PR 4230: Don't flag leaks of NSAutoreleasePools until we know that we aren' at the top-most scope of autorelease pools.

llvm-svn: 72065
This commit is contained in:
Ted Kremenek 2009-05-18 23:14:34 +00:00
parent ec78f1516d
commit 501ba0365a
2 changed files with 16 additions and 0 deletions

View File

@ -1438,6 +1438,10 @@ void RetainSummaryManager::InitializeMethodSummaries() {
addInstMethSummary("NSPanel", NoTrackYet, "initWithContentRect",
"styleMask", "backing", "defer", "screen", NULL);
#endif
// Don't track allocated autorelease pools yet, as it is okay to prematurely
// exit a method.
addClassMethSummary("NSAutoreleasePool", "alloc", NoTrackYet);
// Create NSAssertionHandler summaries.
addPanicSummary("NSAssertionHandler", "handleFailureInFunction", "file",

View File

@ -618,6 +618,18 @@ void test_RDar6859457(RDar6859457 *x, void *bytes, NSUInteger dataLength) {
[NSData dataWithBytesNoCopy:bytes length:dataLength freeWhenDone:1]; // no-warning
}
//===----------------------------------------------------------------------===//
// PR 4230 - an autorelease pool is not necessarily leaked during a premature
// return
//===----------------------------------------------------------------------===//
static void PR4230(void)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // no-warning
NSString *object = [[[NSString alloc] init] autorelease]; // no-warning
return;
}
//===----------------------------------------------------------------------===//
// Method name that has a null IdentifierInfo* for its first selector slot.
// This test just makes sure that we handle it.