This is an archive of the discontinued LLVM Phabricator instance.

[flang] Extend ProvenanceRange::Suffix() to handle crash case
ClosedPublic

Authored by klausler on Mar 2 2022, 1:11 PM.

Details

Summary

Suffix() can be called from AllSources::IntersectionWithSourceFiles()
when a contiguous range of source provenance overlaps a macro expansion.
It skips over the macro expansion and recurses on the remainder of
the range, which might end with a bit that does overlap with a
source file. However, in the case where the original range is
entirely within the expanded macro, Suffix() crashes when called
with a skip offset greater than the size of the range.

Rather than add logic around this and other calls to Suffix() to
avoid passing an out-of-range skip, it's better to accommodate it
in Suffix() and return an empty result.

Diff Detail

Event Timeline

klausler created this revision.Mar 2 2022, 1:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 1:11 PM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Mar 2 2022, 1:11 PM
vdonaldson accepted this revision.Mar 2 2022, 2:11 PM
This revision is now accepted and ready to land.Mar 2 2022, 2:11 PM
This revision was landed with ongoing or failed builds.Mar 2 2022, 3:24 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2022, 3:24 PM