Skip to content

Conversation

@Michael137
Copy link

We've been hitting cases where LLDB marks a decl as isCompleteDefinition but no definition was allocated for it. Then when we access a an API in which Clang assumes a definition exists, and dereferences a nullptr. In the specific case that happens when we've incorrectly been keeping track of the ImportedDecls in clang::ASTImporter (which manifests as trying to MapImported on two different destination decls from the same source decl for the same ClangASTImporterDelegate).

The more fundmental issue is that we're failing to complete the type properly. But the fix for that is still in-progress. So we're working around the crash by guarding against failed type completion.

rdar://133958782

We've been hitting cases where LLDB marks a decl as
`isCompleteDefinition` but no definition was allocated
for it. Then when we access a an API in which Clang
assumes a definition exists, and dereferences a nullptr.
In the specific case that happens when we've incorrectly
been keeping track of the `ImportedDecls` in `clang::ASTImporter`
(which manifests as trying to `MapImported` on two different
destination decls from the same source decl for the same
ClangASTImporterDelegate).

The more fundmental issue is that we're failing to complete
the type properly. But the fix for that is still in-progress.
So we're working around the crash by guarding against failed
type completion.

rdar://133958782
is_complete = GetType(pointee_qual_type).GetCompleteType();
// Make sure completion has actually completed the type.
is_complete = GetType(pointee_qual_type).GetCompleteType() &&
HasCompleteDefinition(cxx_record_decl);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which action could have changed the result of HasCompleteDefinition(cxx_record_decl) since line 3747?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the call to GetCompleteType (which does much more than the name suggests)

@Michael137 Michael137 merged commit 5bc9c53 into stable/20240723 Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants