diff options
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 4 | ||||
-rw-r--r-- | test/Analysis/retain-release.m | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index fbe9582516..d3f6ffbb60 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -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", diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index 4a079055c5..b0855ca695 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -619,6 +619,18 @@ void test_RDar6859457(RDar6859457 *x, void *bytes, NSUInteger dataLength) { } //===----------------------------------------------------------------------===// +// 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. //===----------------------------------------------------------------------===// |