[cfe-commits] r129741 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp test/Analysis/variadic-method-types.m

Anders Carlsson andersca at mac.com
Mon Apr 18 18:16:46 PDT 2011


Author: andersca
Date: Mon Apr 18 20:16:46 2011
New Revision: 129741

URL: http://llvm.org/viewvc/llvm-project?rev=129741&view=rev
Log:
Make the VariadicMethodTypeChecker accept block pointers as Objective-C pointers. Fixes PR9746.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
    cfe/trunk/test/Analysis/variadic-method-types.m

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp?rev=129741&r1=129740&r2=129741&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp Mon Apr 18 20:16:46 2011
@@ -593,6 +593,10 @@
     if (ArgTy->isObjCObjectPointerType())
       continue;
 
+    // Block pointers are treaded as Objective-C pointers.
+    if (ArgTy->isBlockPointerType())
+      continue;
+
     // Ignore pointer constants.
     if (isa<loc::ConcreteInt>(msg.getArgSVal(I, state)))
       continue;

Modified: cfe/trunk/test/Analysis/variadic-method-types.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/variadic-method-types.m?rev=129741&r1=129740&r2=129741&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/variadic-method-types.m (original)
+++ cfe/trunk/test/Analysis/variadic-method-types.m Mon Apr 18 20:16:46 2011
@@ -67,6 +67,7 @@
 
 void f(id a, id<P> b, C* c, C<P> *d, FooType fooType, BarType barType) {
   [NSArray arrayWithObjects:@"Hello", a, b, c, d, nil];
+  [NSArray arrayWithObjects:@"Foo", ^{}, nil];
 
   [NSArray arrayWithObjects:@"Foo", "Bar", "Baz", nil]; // expected-warning 2 {{Argument to 'NSArray' method 'arrayWithObjects:' should be an Objective-C pointer type, not 'char *'}}
   [NSDictionary dictionaryWithObjectsAndKeys:@"Foo", "Bar", nil]; // expected-warning {{Argument to 'NSDictionary' method 'dictionaryWithObjectsAndKeys:' should be an Objective-C pointer type, not 'char *'}}





More information about the cfe-commits mailing list