<div dir="ltr">Ok,<div><br></div><div>Thanks guys, then I am going to put this checker in its own implementation file.</div><div><br></div><div>Gabor</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 9, 2019 at 9:54 PM Artem Dergachev <<a href="mailto:noqnoqneo@gmail.com">noqnoqneo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I don't see much overlap between your checker and MallocChecker. You <br>
simply subscribe for PreStmt<CXXNewExpr> and introspect the argument <br>
region (check extent, maybe origins as well), possibly add a visitor to <br>
track it. The only thing i see here is that you might want to add <br>
MallocChecker's visitor to highlight the allocation site for a heap <br>
memory chunk (if you're placement-new-ing into a heap memory chunk) but <br>
that visitor is already shared across multiple checkers; and even then, <br>
you might be able to get away with trackExpressionValue() instead.<br>
<br>
On 12/9/19 5:05 AM, Csaba Dabis wrote:<br>
> Hey!<br>
><br>
> A new idea is rising nowadays to split the checkers into two main<br>
> parts: one for modeling, one for checking for certain issues. In this<br>
> new form the MallocChecker.cpp needs to only contain the modeling. I<br>
> like the idea of having a separated checker for checking.<br>
><br>
><br>
> On Sat, Dec 7, 2019 at 4:58 PM Gábor Márton via cfe-dev<br>
> <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
>> Hi,<br>
>><br>
>> I am working on a SEI CERT checker (Provide placement new with properly aligned pointers to sufficient storage capacity). This should give reports on the following:<br>
>><br>
>> #include <new><br>
>> void f() {<br>
>>    short s;<br>
>>    long *lp = ::new (&s) long; // warning: insufficient storage<br>
>> }<br>
>><br>
>> First I thought, the best place for the implementation would be in the existing MallocChecker.cpp.<br>
>> However, there are a bunch of classes (e.g. the MallocBugVisitor) which seems to be unrelated and not needed for this new check. Now I am fidgeting because maybe it would be better to have a self-contained independent .cpp file for the implementation. What do you think, what do you suggest?<br>
>><br>
>> Thanks,<br>
>> Gabor<br>
>> _______________________________________________<br>
>> cfe-dev mailing list<br>
>> <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br>
</blockquote></div>