Page MenuHomePhabricator

[lldb] Forcefully complete a type when adding nested classes
ClosedPublic

Authored by labath on Aug 14 2020, 5:36 AM.

Details

Summary

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.

Diff Detail

Event Timeline

labath created this revision.Aug 14 2020, 5:36 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2020, 5:36 AM
labath requested review of this revision.Aug 14 2020, 5:36 AM
teemperor accepted this revision.Aug 16 2020, 11:34 PM

LGTM

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
233–271

You could just get the TypeSystemClang from the type (passing a different TypeSystemClang that is not type.getTypeSystem() would lead to strange bugs, so we might as well make that situation impossible by not giving the caller the option).

This revision is now accepted and ready to land.Aug 16 2020, 11:34 PM
This revision was landed with ongoing or failed builds.Aug 17 2020, 2:09 AM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.
lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s
7

In many cases rm -rf %t is not needed. split-file will unlink the output if it was originally a file.

9

No need to change now: -o is recommended (I think the arguments are (1) for aesthetic value (2) when llvm-mc fails, don't leave an empty file)

labath added inline comments.Aug 19 2020, 5:42 AM
lldb/test/Shell/SymbolFile/DWARF/DW_AT_declaration-with-children.s
7

Aha. That seems useful, albeit unexpected.

9

cool