This is an archive of the discontinued LLVM Phabricator instance.

[lldb/DWARF] Add a utility function for (forceful) completion of types
ClosedPublic

Authored by labath on Jul 6 2020, 2:11 AM.

Details

Summary

Unify the code for requiring a complete type and move it into a single
place. The only functional change is that the "cannot start a definition
of an incomplete type" is upgrated from a runtime error/warning to an
lldbassert. An plain assert might also be fine, since (AFAICT) this can
only happen in case of a programmer error.

Diff Detail

Event Timeline

labath created this revision.Jul 6 2020, 2:11 AM
Herald added a project: Restricted Project. · View Herald Transcript
shafik accepted this revision.Jul 6 2020, 3:06 PM

LGTM

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
1339

This has to be a TagDecl so why use auto?

This revision is now accepted and ready to land.Jul 6 2020, 3:06 PM
teemperor accepted this revision.Jul 6 2020, 3:45 PM

LGTM too, thanks!

lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
1339

const TagDecl *td = ClangUtil::GetAsTagDecl(type);

labath marked 3 inline comments as done.Jul 7 2020, 2:39 AM
labath added inline comments.
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
1339

I think this is a borderline case of "use auto when the type is obvious" policy -- the type name is embedded in the function name, but there's technically no guarantee that it really returns that (it could return an Expected<TagDecl> among other things). OTOH, the name is short enough to just spell it out.
The ClangUtil thingy is cool though.

This revision was automatically updated to reflect the committed changes.
labath marked an inline comment as done.