]> granicus.if.org Git - clang/commitdiff
retain/release checker: For now don't track the retain count of NSWindow objects...
authorTed Kremenek <kremenek@apple.com>
Mon, 23 Feb 2009 02:51:29 +0000 (02:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 23 Feb 2009 02:51:29 +0000 (02:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65304 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/CFRefCount.cpp
test/Analysis/NSWindow.m

index 0d5752d55bc7d8d8d7202dbf9e6ba09a691f2685..3816c560b3b97792b65626df6b9083e5bb5bcc0b 100644 (file)
@@ -1130,8 +1130,12 @@ void RetainSummaryManager::InitializeMethodSummaries() {
   addNSObjectMethSummary(GetNullarySelector("autorelease", Ctx), Summ);
   
   // For NSWindow, allocated objects are (initially) self-owned.  
+  // FIXME: For now we opt for false negatives with NSWindow, as these objects
+  //  self-own themselves.  However, they only do this once they are displayed.
+  //  Thus, we need to track an NSWindow's display status.
+  //  This is tracked in <rdar://problem/6062711>.
   RetainSummary *NSWindowSumm =
-    getPersistentSummary(RetEffect::MakeReceiverAlias(), SelfOwn);
+    getPersistentSummary(RetEffect::MakeReceiverAlias(), StopTracking);
   
   addInstMethSummary("NSWindow", NSWindowSumm, "initWithContentRect",
                      "styleMask", "backing", "defer", NULL);
index 93ab871e16f7ee2ed6a8706e3355fbdc5baee1cd..4cab918f50c42099395b54d48af260548fa6c4ed 100644 (file)
@@ -69,7 +69,8 @@ void f2() {
 }
 
 void f2b() {
-  NSWindow *window = [[NSWindow alloc] // expected-warning{{leak}}
+  // FIXME: NSWindow doesn't own itself until it is displayed.
+  NSWindow *window = [[NSWindow alloc] // no-warning
                       initWithContentRect:NSMakeRect(0,0,100,100) 
                         styleMask:NSTitledWindowMask|NSClosableWindowMask
                         backing:NSBackingStoreBuffered