<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div>Hi,<br></div>
<div> </div>
<div>This probably belongs to cfe-commits instead.<br></div>
<div> </div>
<div>Regarding FindMethodCallAnywhere(): would this find method calls that are not direct children of the initializer Expr? For example:<br></div>
<div> </div>
<blockquote><div>struct Moo {<br></div>
<div>    explicit Moo(int n) {}<br></div>
<div>};<br></div>
<div> </div>
<div>int global_func(int x) { return x; }<br></div>
<div> </div>
<div>struct Foo : Moo {<br></div>
<div>    Foo() : Moo(global_func(member_func())) {}<br></div>
<div> </div>
<div>    int member_func() { return 42; }<br></div>
<div>};<br></div>
</blockquote><div> </div>
<div>If not, consider using a RecursiveASTVisitor instead. Regardless of whether it currently works, you should test for this in your test file.<br></div>
<div> </div>
<div>Otherwise, it's looking good to me, good job!<br></div>
<div> </div>
<div>I also think that this would definitely qualify to become a compiler warning.<br></div>
<div> </div>
<div id="sig19426269"><div class="signature">---<br></div>
<div class="signature">Best regards,<br></div>
<div class="signature"> </div>
<div class="signature">Gábor 'ShdNx' Kozár<br></div>
<div class="signature"><a href="http://gaborkozar.me">http://gaborkozar.me</a><br></div>
<div class="signature"> </div>
</div>
<div> </div>
<div> </div>
<div>On Thu, Dec 4, 2014, at 01:30, Emily Bellows wrote:<br></div>
<blockquote type="cite"><div>Hi everyone,<br></div>
<div> </div>
<div>I’ve been writing one of the potential checkers from the clang-analyzer<br></div>
<div>website. It detects calls to member functions before all base classes are<br></div>
<div>initialized in a constructor initializer list, which the standard says is<br></div>
<div>undefined behavior (C++11 12.6.2.p13.)<br></div>
<div> </div>
<div>My checker finds these cases fine, it runs perfectly on the examples<br></div>
<div>given from the standard, and I ran it on the LLVM codebase and it even<br></div>
<div>found three instances of this (calls to allocHungoffUses in<br></div>
<div>lib/IR/Instructions.cpp if you’re curious, lines 89, 196, and 3579.)<br></div>
<div> </div>
<div>Questions,<br></div>
<div> </div>
<div>1. Does this seem like it might be better as a compiler warning? Right<br></div>
<div>now the checker only uses checkASTDecl, and so is not path sensitive. It<br></div>
<div>could be made path sensitive in the future to detect code indirectly<br></div>
<div>using ’this’, however.<br></div>
<div> </div>
<div>2. Does the ReportBug method look sensible? Given the check is not path<br></div>
<div>sensitive, I couldn’t quite figure out what the PathDiagnosticLocation<br></div>
<div>class is supposed to represent, or whether or not I’m using it correctly<br></div>
<div>because most of the constructors take an ExplodedNode. The error messages<br></div>
<div>my checker gives out looks reasonable to me, so it works, but I’m not<br></div>
<div>sure if it’s idiomatic usage of the reporting API.<br></div>
<div> </div>
<div>Example error:<br></div>
<div> </div>
<div>/Users/emilybellows/Workspace/llvm/lib/IR/Instructions.cpp:89:17:<br></div>
<div>warning:<br></div>
<div>Method called before all bases were initialized<br></div>
<div>                allocHungoffUses(PN.getNumOperands()),<br></div>
<div>                PN.getNumOperands()),<br></div>
<div>                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br></div>
<div> </div>
<div>3. Who is the code owner of this part of clang for when I end up<br></div>
<div>submitting the patch. Is the owner Chris Lattner by default? And does<br></div>
<div>this patch look ready to submit to cfe-commits?<br></div>
<div> </div>
<div>I welcome any other comments too, this is my first time working with<br></div>
<div>either LLVM or Clang, and my first time contributing code to an open<br></div>
<div>source project.<br></div>
<div> </div>
<div>Thanks,<br></div>
<div>Emily<br></div>
<div> </div>
<div> </div>
<div> </div>
<div><u>_______________________________________________</u><br></div>
<div>cfe-dev mailing list<br></div>
<div><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br></div>
<div><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></div>
<p>Email had 1 attachment:<br></p><ul><li><code>newchecker.patch</code><br>  6k (application/octet-stream)</li></ul></blockquote><div> </div>
</body>
</html>