[PATCH] D71612: [analyzer] Add PlacementNewChecker
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 17 08:28:32 PST 2019
martong created this revision.
martong added reviewers: NoQ, Szelethus.
Herald added subscribers: cfe-commits, Charusso, gamesh411, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware, xazax.hun, whisperity, mgorny.
Herald added a project: clang.
This checker verifies if default placement new is provided with pointers
to sufficient storage capacity.
Noncompliant Code Example:
#include <new>
void f() {
short s;
long *lp = ::new (&s) long;
}
Based on SEI CERT rule MEM54-CPP
https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM54-CPP.+Provide+placement+new+with+properly+aligned+pointers+to+sufficient+storage+capacity
This patch does not implement checking of the alignment.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71612
Files:
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
clang/test/Analysis/placement-new-user-defined.cpp
clang/test/Analysis/placement-new.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71612.234311.patch
Type: text/x-patch
Size: 11244 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191217/8f039008/attachment.bin>
More information about the cfe-commits
mailing list