]> granicus.if.org Git - clang/commit
[analyzer] When we fail to evaluate a pointer cast, escape the pointer.
authorArtem Dergachev <artem.dergachev@gmail.com>
Thu, 19 Apr 2018 23:24:32 +0000 (23:24 +0000)
committerArtem Dergachev <artem.dergachev@gmail.com>
Thu, 19 Apr 2018 23:24:32 +0000 (23:24 +0000)
commitaddfb0519a3a8b1eea81c83b8f458722a1775e44
treeee71b0be1182ff189634f0a06d56cd7e31256e88
parenta7da2380bd9d5e0de4b899e6048ea9a1c8788ec0
[analyzer] When we fail to evaluate a pointer cast, escape the pointer.

If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the
analyzer) and such cast is in fact the last use of the pointer, the pointer
symbol is no longer referenced by the program state and a leak is
(mis-)diagnosed.

"Escape" the pointer upon a failed cast, i.e. inform the checker that we can no
longer reliably track it.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330380 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
lib/StaticAnalyzer/Core/ExprEngine.cpp
lib/StaticAnalyzer/Core/ExprEngineC.cpp
test/Analysis/malloc.mm
test/Analysis/pr22954.c