[all-commits] [llvm/llvm-project] d7ea60: [flang] Avoid crash case in provenance mapping

Peter Klausler via All-commits all-commits at lists.llvm.org
Mon Mar 7 11:41:13 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d7ea6068e5ad0a75dfd8e6eb09d8f0d26df755fc
      https://github.com/llvm/llvm-project/commit/d7ea6068e5ad0a75dfd8e6eb09d8f0d26df755fc
  Author: Peter Klausler <pklausler at nvidia.com>
  Date:   2022-03-07 (Mon, 07 Mar 2022)

  Changed paths:
    M flang/lib/Parser/provenance.cpp

  Log Message:
  -----------
  [flang] Avoid crash case in provenance mapping

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.

Differential Revision: https://reviews.llvm.org/D121124




More information about the All-commits mailing list