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

彩云追月 wuming_81 at 163.com
Mon Feb 2 11:16:12 PST 2015


Hello ,
    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 
}   


Currently, I want to study clang static analyzer through developing some checkers.But I do not know whether my patches will be accepted by the clang community. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150203/0c9c2b21/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: StrLengthCalculationChecker.cpp
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150203/0c9c2b21/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: str_length_calculation_test.cpp
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150203/0c9c2b21/attachment-0001.ksh>


More information about the cfe-dev mailing list