[all-commits] [llvm/llvm-project] 882a05: [Format] Fix crash when hitting eof while lexing J...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Oct 6 08:01:01 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 882a05afa17f2a8863978027f562934cd7a7d179
      https://github.com/llvm/llvm-project/commit/882a05afa17f2a8863978027f562934cd7a7d179
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M clang/lib/Format/FormatTokenLexer.cpp
    M clang/unittests/Format/FormatTestJS.cpp

  Log Message:
  -----------
  [Format] Fix crash when hitting eof while lexing JS template string

Different loop termination conditions resulted in confusion of whether
*Offset was intended to be inside or outside the token.
This ultimately led to constructing an out-of-range SourceLocation.

Fix by making Offset consistently point *after* the token.

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




More information about the All-commits mailing list