<div dir="ltr"><div><div><div>Hello everyone!<br><br></div>I have implemented a prototype of <span class="gmail-m_-648948697098736473gmail-name">"different.ConversionToBool</span><span class="gmail-m_-648948697098736473gmail-lang">
(C, C++)".<br></span></div><span class="gmail-m_-648948697098736473gmail-lang">According to list of potential checkers (</span><a href="https://clang-analyzer.llvm.org/potential_checkers.html" target="_blank">https://clang-analyzer.llvm.<wbr>org/potential_checkers.html</a>) I've implemented it as the part of existing <span class="gmail-m_-648948697098736473gmail-name">alpha.core.BoolAssignment checker. There is one problem I've faced while testing changes via llvm-lit. There are many FnChecks calls like <i>clang_analyzer_eval</i> in Analysis/casts.[c/m] which are called with integer arguments instead of bool according declaration. Obviously it leads to false positives in implemented checker (implicit cast to boolean). Actually, the question is: What is the best way to avoid such false-positives? I came up with the following possible solutions:<br><br>1. Is there way to distinguish FnCheck CallExpr from common CallExpr (any flag or whatever). If so, it's quite simple to ignore them in the checker.<br></span></div><div><span class="gmail-m_-648948697098736473gmail-name">2. Is there way to determine if checker is running in testing env? And afterwards filter any calls to FnChecks </span><span class="gmail-m_-648948697098736473gmail-name"><span class="gmail-m_-648948697098736473gmail-name">like<i> clang_analyzer_eval </i>by name. As it was implemented in <i>CStringChecker:evalCall</i>.<br></span></span></div><div><span class="gmail-m_-648948697098736473gmail-name">3. Add special FnCheck like <i>clang_analyser_eval_implicit_cast(bool)</i> which is supposed to replace </span><span class="gmail-m_-648948697098736473gmail-name"><span class="gmail-m_-648948697098736473gmail-name"><i>clang_analyzer_eval </i>in cast tests.<br><br></span></span></div><div><span class="gmail-m_-648948697098736473gmail-name"><span class="gmail-m_-648948697098736473gmail-name">Any suggestions?<br></span></span></div><div><span class="gmail-m_-648948697098736473gmail-name"><span class="gmail-m_-648948697098736473gmail-name"><i></i></span></span></div><div><span class="gmail-m_-648948697098736473gmail-name"><br></span></div>Thanks, Alexey K<br clear="all"><div><div><span class="gmail-m_-648948697098736473gmail-lang"></span><div><div><div><br>-- <br><div class="gmail-m_-648948697098736473gmail_signature"><div dir="ltr"><a href="https://www.linkedin.com/profile/view?id=AAMAABn6oKQBDhBteiQnWsYm-S9yxT7wQkfWhSw" target="_blank">linkedin.com/profile</a><br><br><a href="http://github.com/alexeyknyshev" target="_blank">github.com/alexeyknyshev</a><span></span><a href="http:///" target="_blank"></a><span></span><br><a href="https://bitbucket.org/alexeyknyshev/" target="_blank">bitbucket.org/alexeyknyshev</a><br></div></div>
</div></div></div></div></div></div>