[lldb] Check Decl kind when completing -flimit-debug-info types
authorPavel Labath <pavel@labath.sk>
Thu, 13 Aug 2020 13:02:16 +0000 (15:02 +0200)
committerPavel Labath <pavel@labath.sk>
Fri, 14 Aug 2020 10:31:37 +0000 (12:31 +0200)
commitfdc6aea3fd822b639baaa5b666fdf7598d08c8de
treeb8a85cd029bc999cf539e35cf632328daa834954
parente6b1b61054c285efad7bf4ee0a4da53e56944d87
[lldb] Check Decl kind when completing -flimit-debug-info types

The search for the complete class definition can also produce entries
which are not of the expected type. This can happen for instance when
there is a function with the same name as the class we're looking up
(which means that the class needs to be disambiguated with the
struct/class tag in most contexts).

Previously we were just picking the first Decl that the lookup returned,
which later caused crashes or assertion failures if it was not of the
correct type. This patch changes that to search for an entry of the
correct type.

Differential Revision: https://reviews.llvm.org/D85904
lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py
lldb/test/API/functionalities/limit-debug-info/main.cpp
lldb/test/API/functionalities/limit-debug-info/one.cpp
lldb/test/API/functionalities/limit-debug-info/onetwo.h