This is an archive of the discontinued LLVM Phabricator instance.

[flang] Avoid crash case in provenance mapping
ClosedPublic

Authored by klausler on Mar 7 2022, 8:15 AM.

Details

Summary

When a contiguous range of a cooked character stream is being
mapped to a range of source provenance, the code was assuming
that the "end()" position of the input range -- being the character
immediately after the range -- would also follow the range's
source provenance. This isn't always the case.

Modify the code to work with the true last character of the
input range (at end()-1) and to also cope with cases when that
last position truly maps to an earlier provenance, which can happen
when the prescanner has inserted a space into the cooked character
stream.

Diff Detail

Event Timeline

klausler created this revision.Mar 7 2022, 8:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 8:15 AM
Herald added a subscriber: jdoerfert. · View Herald Transcript
klausler requested review of this revision.Mar 7 2022, 8:15 AM
This revision was not accepted when it landed; it landed in state Needs Review.Mar 7 2022, 11:44 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 11:44 AM