[analyzer] Model base to derived casts more precisely.
authorGabor Horvath <xazax.hun@gmail.com>
Mon, 8 Aug 2016 09:22:59 +0000 (09:22 +0000)
committerGabor Horvath <xazax.hun@gmail.com>
Mon, 8 Aug 2016 09:22:59 +0000 (09:22 +0000)
commit44583ce65a81c4e6e4e629d259e9e2851c0c6e6e
tree6ad1d0715baa7d4fb8d032eb2dbb35204aaea89d
parent2ab623b5a31db5fecb08f822cc59433cfb7ccb58
[analyzer] Model base to derived casts more precisely.

Dynamic casts are handled relatively well by the static analyzer.
BaseToDerived casts however are treated conservatively. This can cause some
false positives with the NewDeleteLeaks checker.

This patch alters the behavior of BaseToDerived casts. In case a dynamic cast
would succeed use the same semantics. Otherwise fall back to the conservative
approach.

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

llvm-svn: 277989
clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
clang/lib/StaticAnalyzer/Core/CallEvent.cpp
clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
clang/lib/StaticAnalyzer/Core/Store.cpp
clang/test/Analysis/NewDelete-checker-test.cpp