[cfe-commits] r89413 - in /cfe/trunk: lib/Analysis/NSAutoreleasePoolChecker.cpp test/Analysis/retain-release-gc-only.m

Ted Kremenek kremenek at apple.com
Thu Nov 19 16:12:37 PST 2009


Author: kremenek
Date: Thu Nov 19 18:12:36 2009
New Revision: 89413

URL: http://llvm.org/viewvc/llvm-project?rev=89413&view=rev
Log:
Fix null dereference in NSAutoreleasePoolChecker when analyzing messages sent to blocks.

Modified:
    cfe/trunk/lib/Analysis/NSAutoreleasePoolChecker.cpp
    cfe/trunk/test/Analysis/retain-release-gc-only.m

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

==============================================================================
--- cfe/trunk/lib/Analysis/NSAutoreleasePoolChecker.cpp (original)
+++ cfe/trunk/lib/Analysis/NSAutoreleasePoolChecker.cpp Thu Nov 19 18:12:36 2009
@@ -65,6 +65,9 @@
   // the type of the expression.
   const ObjCObjectPointerType* PT =
     receiver->getType()->getAs<ObjCObjectPointerType>();
+  
+  if (!PT)
+    return;  
   const ObjCInterfaceDecl* OD = PT->getInterfaceDecl();
   if (!OD)
     return;  

Modified: cfe/trunk/test/Analysis/retain-release-gc-only.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release-gc-only.m?rev=89413&r1=89412&r2=89413&view=diff

==============================================================================
--- cfe/trunk/test/Analysis/retain-release-gc-only.m (original)
+++ cfe/trunk/test/Analysis/retain-release-gc-only.m Thu Nov 19 18:12:36 2009
@@ -332,6 +332,17 @@
     [pool release]; // expected-warning{{Use -drain instead of -release when using NSAutoreleasePool and garbage collection}}
 }
 
+
+//===----------------------------------------------------------------------===//
+// <rdar://problem/7407273> Don't crash when analyzing messages sent to blocks
+//===----------------------------------------------------------------------===//
+
+ at class RDar7407273;
+typedef void (^RDar7407273Block)(RDar7407273 *operation);
+void rdar7407273(RDar7407273Block b) {
+  [b copy];
+}
+
 //===----------------------------------------------------------------------===//
 // Tests of ownership attributes.
 //===----------------------------------------------------------------------===//





More information about the cfe-commits mailing list