[lldb] Forcefully complete a type when adding nested classes
authorPavel Labath <pavel@labath.sk>
Fri, 14 Aug 2020 12:21:09 +0000 (14:21 +0200)
committerPavel Labath <pavel@labath.sk>
Mon, 17 Aug 2020 09:09:13 +0000 (11:09 +0200)
commit2d89a3ba121b96a4af9aecaf52205eab200394c3
treeecfbb3e72dc708ff4a33969853c952a83fc06add
parentc2f9454a16e45e1df09d8ebed6dadbc0da264442
[lldb] Forcefully complete a type when adding nested classes

With -flimit-debug-info, we can run into cases when we only have a class
as a declaration, but we do have a definition of a nested class. In this
case, clang will hit an assertion when adding a member to an incomplete
type (but only if it's adding a c++ class, and not C struct).

It turns out we already had code to handle a similar situation arising
in the -gmodules scenario. This extends the code to handle
-flimit-debug-info as well, and reorganizes bits of other code handling
completion of types to move functions doing similar things closer
together.

Differential Revision: https://reviews.llvm.org/D85968
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s