<div dir="ltr">Hi guys,<div><br></div><div>Thanks for all the suggestions! I'm starting to run my check in our code base (around 2M C++ lines) and the ratio of good findings and noise.<br><br>But as many of you said, there are already several well agreed guidelines that can be checked, and I will start picking some of them and produce the checks. Hopefully I can contribute very soon (I can only play with this at nights and weekends, but still...).</div><div><br>I also liked the idea of adding configurations and tweaks to existing checks. That's a good way to see how the APIs are used and what's available.<br><br>I appreciate the responses!<br><br>Best regards,</div><div>Breno G.</div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 16, 2017 at 6:51 PM, Richard via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
[Please reply *only* to the list and do not include my email directly<br>
in the To: or Cc: of your reply; otherwise I will not see your reply.<br>
Thanks.]<br>
<br>
In article <<a href="mailto:CAAt6xTtzDzbTmKwi_RjTuJt70mZ7RHL1GbR_2Bi5EUJTMSFBiA@mail.gmail.com">CAAt6xTtzDzbTmKwi_<wbr>RjTuJt70mZ7RHL1GbR_<wbr>2Bi5EUJTMSFBiA@mail.gmail.com</a>><wbr>,<br>
<span class="">    Aaron Ballman via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> writes:<br>
<br>
> On Thu, Mar 16, 2017 at 12:54 AM, Breno Guimarães via cfe-dev<br>
> <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br>
><br>
</span><span class="">> > 2 - Any feedback on this specific check?<br>
><br>
</span><span class="">> Adding some intelligence to the check so that it suggests removing the<br>
> validity check, or suggests replacing the pointer with a reference,<br>
> when sensible to do so would make this a much better check IMO.<br>
<br>
</span>One very common case from programmers with a C background is to check<br>
the result of new against NULL/nullptr/0.  Other static analyzers like<br>
cppcheck have such a check already.  If clang/clang-tidy doesn't<br>
already warn on code like this, that would be a good addition.<br>
<br>
Another check in the same spirit is where code checks for non-nullptr<br>
at some point and then checks against nullptr again.  This usually<br>
happens in large functions where the earlier check against nullptr is<br>
"out of sight, out of mind" when someone is adding the second check<br>
against nullptr.<br>
<br>
Again, this would be a welcome addition to clang/clang-tidy if we<br>
don't already have something like that.<br>
<span class="HOEnZb"><font color="#888888">--<br>
"The Direct3D Graphics Pipeline" free book <<a href="http://tinyurl.com/d3d-pipeline" rel="noreferrer" target="_blank">http://tinyurl.com/d3d-<wbr>pipeline</a>><br>
            The Terminals Wiki <<a href="http://terminals-wiki.org" rel="noreferrer" target="_blank">http://terminals-wiki.org</a>><br>
     The Computer Graphics Museum <<a href="http://ComputerGraphicsMuseum.org" rel="noreferrer" target="_blank">http://<wbr>ComputerGraphicsMuseum.org</a>><br>
  Legalize Adulthood! (my blog) <<a href="http://LegalizeAdulthood.wordpress.com" rel="noreferrer" target="_blank">http://LegalizeAdulthood.<wbr>wordpress.com</a>><br>
</font></span><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Breno Rodrigues Guimarães<div>Universidade Federal de Minas Gerais - UFMG, Brasil</div><div>(Federal University of Minas Gerais, Brazil)</div><div><br></div><div><br></div></div>
</div>