[analyzer] operator new: Add a new checker callback, check::NewAllocator.
authorArtem Dergachev <artem.dergachev@gmail.com>
Wed, 17 Jan 2018 23:46:13 +0000 (23:46 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Wed, 17 Jan 2018 23:46:13 +0000 (23:46 +0000)
commit13b2026ba46eb2b439cb8074e2f8ccc5473ec51d
tree2df7455d003dd3868bac74fb075a87313a391971
parentedae5a6e11308852af43115da0a81533ca7ef3a6
[analyzer] operator new: Add a new checker callback, check::NewAllocator.

The callback runs after operator new() and before the construction and allows
the checker to access the casted return value of operator new() (in the
sense of r322780) which is not available in the PostCall callback for the
allocator call.

Update MallocChecker to use the new callback instead of PostStmt<CXXNewExpr>,
which gets called after the constructor.

Differential Revision: https://reviews.llvm.org/D41406
rdar://problem/12180598

llvm-svn: 322787
clang/include/clang/StaticAnalyzer/Core/Checker.h
clang/include/clang/StaticAnalyzer/Core/CheckerManager.h
clang/lib/StaticAnalyzer/Checkers/CheckerDocumentation.cpp
clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
clang/lib/StaticAnalyzer/Core/CheckerManager.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
clang/test/Analysis/NewDelete-custom.cpp
clang/test/Analysis/new-ctor-malloc.cpp [new file with mode: 0644]