This is an archive of the discontinued LLVM Phabricator instance.

[ASTimporter] Remove decl from lookup only if it has decl context
ClosedPublic

Authored by steakhal on May 17 2021, 10:35 AM.

Details

Summary

In the case of TypedefDecls we set the DeclContext after we imported it.
It turns out, it could lead to null pointer dereferences during the cleanup part of a failed import.

This patch demonstrates this issue and fixes it by checking if the DeclContext is available or not.

Diff Detail

Event Timeline

steakhal created this revision.May 17 2021, 10:35 AM
steakhal requested review of this revision.May 17 2021, 10:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 17 2021, 10:35 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
shafik accepted this revision.May 17 2021, 4:16 PM

This is a good catch, thank you for fixing this!

This revision is now accepted and ready to land.May 17 2021, 4:16 PM

This is a good catch, thank you for fixing this!

Thanks for the quick review!

Post commit looks good to me as well.
@steakhal Nice work! @shafik Thanks for the review!