[all-commits] [llvm/llvm-project] 93f424: [flang] Extend ProvenanceRange::Suffix() to handle...

Peter Klausler via All-commits all-commits at lists.llvm.org
Wed Mar 2 15:24:52 PST 2022


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

  Changed paths:
    M flang/include/flang/Common/interval.h

  Log Message:
  -----------
  [flang] Extend ProvenanceRange::Suffix() to handle crash case

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.

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




More information about the All-commits mailing list