[all-commits] [llvm/llvm-project] d03e34: [clang-format] Fix assertion failure/crash with `A...

Marek Kurdej via All-commits all-commits at lists.llvm.org
Mon Mar 7 07:54:28 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d03e342803df7a75fb86c5a5c07cd84f3683bef9
      https://github.com/llvm/llvm-project/commit/d03e342803df7a75fb86c5a5c07cd84f3683bef9
  Author: Marek Kurdej <marek.kurdej+llvm.org at gmail.com>
  Date:   2022-03-07 (Mon, 07 Mar 2022)

  Changed paths:
    M clang/lib/Format/UnwrappedLineFormatter.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Fix assertion failure/crash with `AllowShortFunctionsOnASingleLine: Inline/InlineOnly`.

Fixes https://github.com/llvm/llvm-project/issues/54147.

When handling `AllowShortFunctionsOnASingleLine`, we were searching for the last line with a smaller level than the current line. The search was incorrect when the first line had the same level as the current one. This led to an unsatisfied assumption about the existence of a brace (non-comment token).

Reviewed By: HazardyKnusperkeks, owenpan

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




More information about the All-commits mailing list