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

Ted Kremenek kremenek at apple.com
Wed Mar 4 15:30:42 PST 2009


Author: kremenek
Date: Wed Mar  4 17:30:42 2009
New Revision: 66107

URL: http://llvm.org/viewvc/llvm-project?rev=66107&view=rev
Log:
For now, do not track NSWindow objects and it's subclasses.

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=66107&r1=66106&r2=66107&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Wed Mar  4 17:30:42 2009
@@ -645,6 +645,13 @@
   void addNSObjectMethSummary(Selector S, RetainSummary *Summ) {
     ObjCMethodSummaries[S] = Summ;
   }
+
+  void addClassMethSummary(const char* Cls, const char* nullaryName,
+                           RetainSummary *Summ) {
+    IdentifierInfo* ClsII = &Ctx.Idents.get(Cls);
+    Selector S = GetNullarySelector(nullaryName, Ctx);
+    ObjCClassMethodSummaries[ObjCSummaryKey(ClsII, S)]  = Summ;
+  }
   
   void addInstMethSummary(const char* Cls, const char* nullaryName,
                           RetainSummary *Summ) {
@@ -1150,6 +1157,11 @@
   //  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>.
+  //  See also http://llvm.org/bugs/show_bug.cgi?id=3714.
+  addClassMethSummary("NSWindow", "alloc",
+                      getPersistentSummary(RetEffect::MakeNoRet()));
+
+#if 0
   RetainSummary *NSWindowSumm =
     getPersistentSummary(RetEffect::MakeReceiverAlias(), StopTracking);
   
@@ -1158,6 +1170,7 @@
   
   addInstMethSummary("NSWindow", NSWindowSumm, "initWithContentRect",
                      "styleMask", "backing", "defer", "screen", NULL);
+#endif
     
   // For NSPanel (which subclasses NSWindow), allocated objects are not
   //  self-owned.

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

==============================================================================
--- cfe/trunk/test/Analysis/NSWindow.m (original)
+++ cfe/trunk/test/Analysis/NSWindow.m Wed Mar  4 17:30:42 2009
@@ -84,5 +84,6 @@
 
 
 void f3() {
-  NSWindow *window = [NSWindow alloc];  // expected-warning{{never read}} expected-warning{{leak}}
+  // FIXME: For now we don't track NSWindow.
+  NSWindow *window = [NSWindow alloc];  // expected-warning{{never read}}
 }





More information about the cfe-commits mailing list