]> granicus.if.org Git - clang/commitdiff
For now, do not track NSWindow objects and it's subclasses.
authorTed Kremenek <kremenek@apple.com>
Wed, 4 Mar 2009 23:30:42 +0000 (23:30 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 4 Mar 2009 23:30:42 +0000 (23:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66107 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 7e6507cbe53411ca4a5e321605c580ae702f5f38..08f4b64f76f2f50f16119262b073d798e9a4e3e7 100644 (file)
@@ -645,6 +645,13 @@ private:
   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 @@ void RetainSummaryManager::InitializeMethodSummaries() {
   //  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 @@ void RetainSummaryManager::InitializeMethodSummaries() {
   
   addInstMethSummary("NSWindow", NSWindowSumm, "initWithContentRect",
                      "styleMask", "backing", "defer", "screen", NULL);
+#endif
     
   // For NSPanel (which subclasses NSWindow), allocated objects are not
   //  self-owned.
index 4cab918f50c42099395b54d48af260548fa6c4ed..6bddaeb695c4b2306bdbef39919d23d17e861263 100644 (file)
@@ -84,5 +84,6 @@ void f2b() {
 
 
 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}}
 }