[cfe-commits] r150260 - in /cfe/trunk: lib/Sema/SemaChecking.cpp test/SemaCXX/format-strings.cpp

Ted Kremenek kremenek at apple.com
Fri Feb 10 11:52:27 PST 2012


On Feb 10, 2012, at 11:42 AM, David Blaikie <dblaikie at gmail.com> wrote:

> On Fri, Feb 10, 2012 at 11:13 AM, Ted Kremenek <kremenek at apple.com> wrote:
>> Author: kremenek
>> Date: Fri Feb 10 13:13:51 2012
>> New Revision: 150260
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=150260&view=rev
>> Log:
>> Enhance checking for null format string literal to take into account __null.   Fixes <rdar://problem/8269537>.
>> 
>> Modified:
>>    cfe/trunk/lib/Sema/SemaChecking.cpp
>>    cfe/trunk/test/SemaCXX/format-strings.cpp
>> 
>> Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=150260&r1=150259&r2=150260&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Feb 10 13:13:51 2012
>> @@ -1381,6 +1381,7 @@
>>                                  inFunctionCall);
>>   }
>> 
>> +  case Stmt::GNUNullExprClass:
>>   case Stmt::IntegerLiteralClass:
> 
> could/should this be generalized over all null pointer literals?

Absolutely.

> 
> This, for example, still flags 'nullptr' and (to a more questionable
> extent) 'false' which is still technically a valid null pointer. If
> I'm reading/testing it correctly, that is.

It's questionable whether we should be happy with any integer literal, but definitely we should not warn about any cases of null.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120210/061cfc3d/attachment.html>


More information about the cfe-commits mailing list