[analyzer] PR41269: Add a bit of C++ smart pointer modeling.
authorArtem Dergachev <artem.dergachev@gmail.com>
Tue, 23 Apr 2019 02:45:42 +0000 (02:45 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Tue, 23 Apr 2019 02:45:42 +0000 (02:45 +0000)
commit8c6119a44275852b868c6df0c14ee85efeb2a9e5
tree86c6dca212d30da5c4768eeabb68af088ddf57b4
parent32c0ebe615772f25b4cadb82bc3ad809afa62641
[analyzer] PR41269: Add a bit of C++ smart pointer modeling.

Implement cplusplus.SmartPtrModeling, a new checker that doesn't
emit any warnings but models methods of smart pointers more precisely.

For now the only thing it does is make `(bool) P` return false when `P`
is a freshly moved pointer. This addresses a false positive in the
use-after-move-checker.

Differential Revision: https://reviews.llvm.org/D60796

llvm-svn: 358944
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt
clang/lib/StaticAnalyzer/Checkers/Move.h [new file with mode: 0644]
clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp [new file with mode: 0644]
clang/test/Analysis/Inputs/system-header-simulator-cxx.h
clang/test/Analysis/smart-ptr.cpp [new file with mode: 0644]
clang/test/Analysis/use-after-move.cpp