From: Anders Carlsson Date: Tue, 19 Apr 2011 01:16:46 +0000 (+0000) Subject: Make the VariadicMethodTypeChecker accept block pointers as Objective-C pointers... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f05982b5f8f69a1d618c3bd844ab6efd3a6e2953;p=clang Make the VariadicMethodTypeChecker accept block pointers as Objective-C pointers. Fixes PR9746. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129741 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp index 2790a19c61..235b400eb9 100644 --- a/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp +++ b/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp @@ -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(msg.getArgSVal(I, state))) continue; diff --git a/test/Analysis/variadic-method-types.m b/test/Analysis/variadic-method-types.m index 76a05ed9c0..018956ab1b 100644 --- a/test/Analysis/variadic-method-types.m +++ b/test/Analysis/variadic-method-types.m @@ -67,6 +67,7 @@ typedef struct BarType * BarType; void f(id a, id

b, C* c, C

*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 *'}}