[cfe-dev] [Analyzer] Placement new related checker

Gábor Márton via cfe-dev cfe-dev at lists.llvm.org
Sat Dec 7 07:58:30 PST 2019


Hi,

I am working on a SEI CERT checker (Provide placement new with properly
aligned pointers to sufficient storage capacity
<https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM54-CPP.+Provide+placement+new+with+properly+aligned+pointers+to+sufficient+storage+capacity>).
This should give reports on the following:

#include <new>
void f() {
  short s;
  long *lp = ::new (&s) long; // warning: insufficient storage
}

First I thought, the best place for the implementation would be in the
existing MallocChecker.cpp.
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?

Thanks,
Gabor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191207/7c1ab343/attachment.html>


More information about the cfe-dev mailing list