[Lldb-commits] [lldb] [lldb] Fix crash when adding members to an "incomplete" type (PR #102116)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 04:48:36 PDT 2024


labath wrote:

> LGTM, thanks!
> 
> So the actual problem is that the ASTImporter will only copy over the definition to the destination decl if the source decl `isCompleteDefinition`. So then when we tried to add the typedef decl to the `CXXRecordDecl` that the ASTImporter created for `A`, it would try to query its definition which didn't get copied over (cause we only ever started the definition for `A`, but nothing completed it, especially since it had no external storage), and hence we assert.

No, the problem was that `A` was stuck in this half-complete state, where we've begun -- but not finished -- it's definition, and it also didn't have an external ast source which could complete it (because we've already tried completing it, and CompleteTypeFromDWARF has cleared the "external" flag). AFAICT, the ast importer is just not prepared to handle this situation. The crash happened when it tried to query some property (probably to copy it over) of the source Decl, and this crashed because the decl didn't have the DefinitionData field set up.

https://github.com/llvm/llvm-project/pull/102116


More information about the lldb-commits mailing list