[PATCH] [StaticAnalyzer] New checker StringPlusChar

Jordan Rose jordan_rose at apple.com
Tue Oct 22 12:08:20 PDT 2013


On Oct 21, 2013, at 22:39 , Daniel Marjamäki <Daniel.Marjamaki at evidente.se> wrote:

> 
> Hello!
> 
> There was a thread about the new checker StringPlusChar:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/thread.html#89826
> 
> I wonder what we need to do to make you happy?
> 
> My last response is here:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131007/090324.html
> 
> About this:
>> The idea and the patch both seem good to me, other than the diagnostic wording. Perhaps something like:
>>  adding %0 to %1 does not append to the string
> 
> The latest patch from Anders fixes this, it writes such messages:
> 
>  char *str = 0;
>  char *str2 = str + 'c'; // expected-warning {{adding 'char' to a string pointer does not append to the string}} expected-note {{use array indexing to silence this warning}}


I'm sorry, this still doesn't include the type:

// clang++ -fsyntax-only -std=c++11
char *str = 0;
char *str2 = str + u'a'; // expected-warning {{adding 'char16_t' to a string pointer does not append to the string}}

Jordan



More information about the cfe-commits mailing list