Page MenuHomePhabricator

[Sema] Fix a crash when attaching comments to an implicit decl

Authored by erik.pilkington on Mar 2 2020, 2:25 PM.



When an implicitly generated decl was the first entry in the group, we attempted to lookup comments with an empty FileID, leading to crashes. Avoid this by trying to use the other declarations in a group, then bailing out if none are valid.


Diff Detail

Event Timeline

erik.pilkington created this revision.Mar 2 2020, 2:25 PM
jkorous accepted this revision.Mar 2 2020, 3:11 PM

Thanks a bunch for fixing this!

That also means we can skip all the implicit declarations from the for (const Decl *D : Decls) { just a couple lines below your fix since implicit declaration can hardly have a doc comment attached... I'll send a patch.

This revision is now accepted and ready to land.Mar 2 2020, 3:11 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2020, 4:55 PM