<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello ,</div><div> I implemented another checker for clang static checker. </div><div><span style="line-height: 1.7;"> </span><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;">It checks that some code uses strlen(or wcslen) </span><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;"> to calculate the length of an </span><code style="color: rgb(34, 34, 34);">std::string( or std::wstring)</code><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;">.</span></div><div><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;"> </span></div><div><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;"> example: </span></div><div><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;"><br></span></div><pre style="margin: 1px; font-size: 10.5625px; color: rgb(34, 34, 34);">#include <string>
#include <string.h>
void test() {
std::string s;
if (strlen(s.c_str()) != 0) {}; // warn </pre><div><span style="color: rgb(34, 34, 34); font-family: arial; font-size: 10.5625px; white-space: pre-wrap; line-height: 1.7;">}</span><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;"> </span></div><div><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;"><br></span></div><div><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;">Currently, I want to study clang static analyzer </span><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;">through developing some checkers</span><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;">.But I do not know whether my patches will be accepted by the clang community. </span></div><div><span style="color: rgb(34, 34, 34); font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, Verdana, Helvetica, sans-serif; font-size: 13px; line-height: 15.6000003814697px;"><br></span></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>