[all-commits] [llvm/llvm-project] 1fa115: [clang-format] Correctly indent closing brace of c...

Emilia Dreamer via All-commits all-commits at lists.llvm.org
Fri Sep 30 22:35:13 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1fa115b569797f64988f3d8ddd8baa05574aafa3
      https://github.com/llvm/llvm-project/commit/1fa115b569797f64988f3d8ddd8baa05574aafa3
  Author: Emilia Dreamer <emilia at rymiel.space>
  Date:   2022-10-01 (Sat, 01 Oct 2022)

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

  Log Message:
  -----------
  [clang-format] Correctly indent closing brace of compound requires

When a compound requirement is too long to fit onto a single line, the
braces are split apart onto separate lines, and the contained expression
is indented. However, this indentation would also apply to the closing
brace and the trailing return type requirement thereof.
This was because the indentation level was being restored after all
trailing things were already read

With this change, the initial level of the opening brace is set before
attempting to read any trailing return type requirements

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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




More information about the All-commits mailing list