]> granicus.if.org Git - clang/commit
[analyzer] Use the static type for a virtual call if the dynamic type is worse.
authorJordan Rose <jordan_rose@apple.com>
Tue, 11 Sep 2012 18:47:13 +0000 (18:47 +0000)
committerJordan Rose <jordan_rose@apple.com>
Tue, 11 Sep 2012 18:47:13 +0000 (18:47 +0000)
commit19d5886d1704e24282c86217b09d5c6d35ba604d
tree949e513cba44498fbde358b83015d0db2b52a657
parentc9e418c21c7a05ac90fd8013a19c6d1a86b052ee
[analyzer] Use the static type for a virtual call if the dynamic type is worse.

reinterpret_cast does not provide any of the usual type information that
static_cast or dynamic_cast provide -- only the new type. This can get us
in a situation where the dynamic type info for an object is actually a
superclass of the static type, which does not match what CodeGen does at all.
In these cases, just fall back to the static type as the best possible type
for devirtualization.

Should fix the crashes on our internal buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163644 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Core/CallEvent.cpp
test/Analysis/inlining/dyn-dispatch-bifurcate.cpp