<div dir="ltr">There are still a few core issues to resolve in the analyzer before it'll get really useful for large C++ codebases (<- opinion :) and I think that's why we're not seeing that many C++ related checks.<br><div><br></div><div>Specifically, temporary constructors/destructors still have work to do, especially regarding passing temporaries as by-value function parameters.</div></div><br><div class="gmail_quote">On Mon, Mar 16, 2015 at 11:22 PM Adam Romanek <<a href="mailto:romanek.adam@gmail.com">romanek.adam@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi!<div><br></div><div>I'm new to this list and to Clang development. Nevertheless I've been interested in Clang Static Analyzer for a while. I've been using it on a large code base with a lot of success. So let me start by saying: thanks for this amazing piece of code!</div><div><br></div><div>But... Some time ago I realized there are hardly any strictly C++ related checkers in CSA. I was wondering if there's any movement in this area. I was thinking about some checkers for use-after-free for STL containers like std::string, for example:</div><div><br></div><div>const char* x = NULL;</div><div>{</div><div>  std::string foo("foo");</div><div>  x = foo.c_str();</div><div>}</div><div>printf("%s", x); // boom</div><div><br></div><div>There are also some other common types of errors in C++ like use of iterator after it has been invalidated. FYI this one in particular is detected by cppcheck.</div><div><br></div><div>So I decided to dig a bit to find out whether it is hard to write a checker for use-after-free like in the example with std::string. It looks like MallocChecker deals with a similar class of issues.</div><div><br></div><div>I was wondering whether it would be the right approach to try to "bend" MallocChecker to my needs (but it's already 2.5k lines of code) or to start something new on my own.</div><div><br></div><div>Honestly it took me some time even to detect a simple std::string constructor call so the road looks rather long and bumpy...</div><div><br></div><div>Any hints, pointers? Any related work?</div><div><br></div><div>Thanks in advance.</div><div><br></div><div>Best regards,</div><div>Adam Romanek</div></div>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div>