[clang-format] Add new LambdaBodyIndentation option
authorVitali Lovich <vlovich@gmail.com>
Tue, 22 Jun 2021 18:39:27 +0000 (20:39 +0200)
committerBjörn Schäpers <bjoern@hazardy.de>
Tue, 22 Jun 2021 19:46:16 +0000 (21:46 +0200)
commit64cf5eba06bd4f81954253b1e7a10be6fe92403e
tree26a614792052bfeb307d4a0cbcb2de3aadf205d1
parent21c008d5a5b1e0c2ec3c1659cff961f4b0ccea2c
[clang-format] Add new LambdaBodyIndentation option

Currently the lambda body indents relative to where the lambda signature is located. This instead lets the user
choose to align the lambda body relative to the parent scope that contains the lambda declaration. Thus:

someFunction([] {
  lambdaBody();
});

will always have the same indentation of the body even when the lambda signature goes on a new line:

someFunction(
    [] {
  lambdaBody();
});

whereas before lambdaBody would be indented 6 spaces.

Differential Revision: https://reviews.llvm.org/D102706
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTest.cpp