[cfe-commits] r65304 - in /cfe/trunk: lib/Analysis/CFRefCount.cpp test/Analysis/NSWindow.m

Ted Kremenek kremenek at apple.com
Sun Feb 22 18:51:29 PST 2009


Author: kremenek
Date: Sun Feb 22 20:51:29 2009
New Revision: 65304

URL: http://llvm.org/viewvc/llvm-project?rev=65304&view=rev
Log:
retain/release checker: For now don't track the retain count of NSWindow objects (opt for false negatives).

Modified:
    cfe/trunk/lib/Analysis/CFRefCount.cpp
    cfe/trunk/test/Analysis/NSWindow.m

Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=65304&r1=65303&r2=65304&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Sun Feb 22 20:51:29 2009
@@ -1130,8 +1130,12 @@
   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);

Modified: cfe/trunk/test/Analysis/NSWindow.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/NSWindow.m?rev=65304&r1=65303&r2=65304&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/NSWindow.m (original)
+++ cfe/trunk/test/Analysis/NSWindow.m Sun Feb 22 20:51:29 2009
@@ -69,7 +69,8 @@
 }
 
 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





More information about the cfe-commits mailing list