]> granicus.if.org Git - clang/commitdiff
retain/release checker: don't track NSPanel until we have better reasoning about
authorTed Kremenek <kremenek@apple.com>
Fri, 3 Apr 2009 19:02:51 +0000 (19:02 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 3 Apr 2009 19:02:51 +0000 (19:02 +0000)
the subtle ownership issues of such objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68397 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 95df6b4c1c31c01bcb89aa90f28a0d72d9b4179c..4473dbf0869369d3e0e183c9d50bedb4da162864 100644 (file)
@@ -1184,8 +1184,10 @@ void RetainSummaryManager::InitializeMethodSummaries() {
   //  Thus, we need to track an NSWindow's display status.
   //  This is tracked in <rdar://problem/6062711>.
   //  See also http://llvm.org/bugs/show_bug.cgi?id=3714.
-  addClassMethSummary("NSWindow", "alloc",
-                      getPersistentSummary(RetEffect::MakeNoRet()));
+  RetainSummary *NoTrackYet = getPersistentSummary(RetEffect::MakeNoRet());
+  
+  addClassMethSummary("NSWindow", "alloc", NoTrackYet);
+
 
 #if 0
   RetainSummary *NSWindowSumm =
@@ -1200,6 +1202,10 @@ void RetainSummaryManager::InitializeMethodSummaries() {
     
   // For NSPanel (which subclasses NSWindow), allocated objects are not
   //  self-owned.
+  // FIXME: For now we don't track NSPanels. object for the same reason
+  //   as for NSWindow objects.
+  addClassMethSummary("NSPanel", "alloc", NoTrackYet);
+  
   addInstMethSummary("NSPanel", InitSumm, "initWithContentRect",
                      "styleMask", "backing", "defer", NULL);
   
index 8f8f5626b3fd71e110a839f904bc7efdfd4d2b13..c4d4c22540f2e59a43f4b0996f4f052fcba9a580 100644 (file)
@@ -82,7 +82,7 @@ extern NSString *NSWindowDidBecomeKeyNotification;
 }
 - (void)myMethod2
 {
-  NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; // expected-warning{{leak}}
+  NSPanel *panel = [[NSPanel alloc] initWithContentRect:NSMakeRect(0, 0, 200, 200) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:(BOOL)1]; // no-warning
 
   [panels addObject:panel];  
 }