[lldb] Fix dynamic_cast by no longer failing on variable without metadata
authorRaphael Isemann <teemperor@gmail.com>
Sat, 10 Aug 2019 10:56:17 +0000 (10:56 +0000)
committerRaphael Isemann <teemperor@gmail.com>
Sat, 10 Aug 2019 10:56:17 +0000 (10:56 +0000)
commitb448d1bf212219febbb182d00c210bad1bd25e7f
tree915ba501e5ddff31cf092a2a5700da1356545530
parentc4b5b66a05bbf53573e4b2f1355b455bc7a37c64
[lldb] Fix dynamic_cast by no longer failing on variable without metadata

Summary:
Our IR rewriting infrastructure currently fails when it encounters a variable which has no metadata associated.
This causes dynamic_cast to fail as in this case IRForTarget considers the type info pointers ('@_ZTI...') to be
variables without associated metadata. As there are no variables for these internal variables, this is actually
not an error and dynamic_cast would work fine if we didn't throw this error.

This patch fixes this by removing this diagnostics code. In case we would actually hit a variable that has no
metadata (but is supposed to have), we still have the error in the expression log so this shouldn't make it
harder to diagnose any missing metadata errors.

This patch should fix dynamic_cast and also adds a bunch of test coverage to that language feature.

Fixes rdar://10813639

Reviewers: davide, labath

Reviewed By: labath

Subscribers: friss, labath, abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 368511
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.cpp [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/ExtBase.h [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/Makefile [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/TestDynamicCast.py [new file with mode: 0644]
lldb/packages/Python/lldbsuite/test/lang/cpp/dynamic_cast/main.cpp [new file with mode: 0644]
lldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp