[cfe-dev] a patch for clang static checker: > optimization.StrLengthCalculation

彩云追月 wuming_81 at 163.com
Tue Feb 3 15:00:02 PST 2015


>Message: 3
>Date: Mon, 02 Feb 2015 14:30:32 -0700
>From: Richard <legalize at xmission.com>
>To: cfe-dev at cs.uiuc.edu
>Subject: Re: [cfe-dev] a patch for clang static checker:
>	optimization.StrLengthCalculation
>Message-ID: <E1YIOZk-0004HR-M3 at shell.xmission.com>
>
>
>In article <7bd94015.2f8.14b4bb8bc12.Coremail.wuming_81 at 163.com>,
>    <wuming_81 at 163.com> writes:
>
>>     I implemented another checker for clang static checker. 
>>     It checks that some code uses strlen(or wcslen)  to calculate the
>> length of an std::string( or std::wstring).
>>     
>>    example: 
>> 
>> 
>> #include <string>
>> #include <string.h>
>> 
>> void test() {
>>   std::string s;
>>   if (strlen(s.c_str()) != 0) {}; // warn 
>> }   
>
>Great!  Are you implementing these only as warnings for the static
>analyzer or are you also implementing a check for clang-tidy since the
>fix is easy to apply?
Yes, I just implemented those as warnings for the static analyzer.I'm sorry that I have not read the source codes of clang-tidy.I will read clang-tidy and try to modify my checker for clang-tidy.Richard, thanks for your feedback !






-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150204/a68ca726/attachment.html>


More information about the cfe-dev mailing list