[clang-format] Correctly indent closing brace of compound requires
authorEmilia Dreamer <emilia@rymiel.space>
Sat, 1 Oct 2022 05:16:45 +0000 (08:16 +0300)
committerEmilia Dreamer <emilia@rymiel.space>
Sat, 1 Oct 2022 05:16:57 +0000 (08:16 +0300)
commit1fa115b569797f64988f3d8ddd8baa05574aafa3
tree2d1872adcde53ede0115a7b4edcfaf2f8defd9ed
parent9273f860c089fd94a4f929ff24da7b331d70f64d
[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
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp