]> granicus.if.org Git - clang/commitdiff
Make the VariadicMethodTypeChecker accept block pointers as Objective-C pointers...
authorAnders Carlsson <andersca@mac.com>
Tue, 19 Apr 2011 01:16:46 +0000 (01:16 +0000)
committerAnders Carlsson <andersca@mac.com>
Tue, 19 Apr 2011 01:16:46 +0000 (01:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129741 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
test/Analysis/variadic-method-types.m

index 2790a19c61cd7d6835227376b805559bcc847e6f..235b400eb9e3f3b1cbc1303c1bad6de855acc920 100644 (file)
@@ -593,6 +593,10 @@ void VariadicMethodTypeChecker::checkPreObjCMessage(ObjCMessage msg,
     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;
index 76a05ed9c0568fa4885596cc3bbb28c26df3aeba..018956ab1b2d76b7292a187f123be135f062e1d9 100644 (file)
@@ -67,6 +67,7 @@ typedef struct BarType * BarType;
 
 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 *'}}