[all-commits] [llvm/llvm-project] 64cf5e: [clang-format] Add new LambdaBodyIndentation option

Björn Schäpers via All-commits all-commits at lists.llvm.org
Tue Jun 22 12:46:31 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 64cf5eba06bd4f81954253b1e7a10be6fe92403e
      https://github.com/llvm/llvm-project/commit/64cf5eba06bd4f81954253b1e7a10be6fe92403e
  Author: Vitali Lovich <vlovich at gmail.com>
  Date:   2021-06-22 (Tue, 22 Jun 2021)

  Changed paths:
    M clang/docs/ClangFormatStyleOptions.rst
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Format/Format.h
    M clang/lib/Format/Format.cpp
    M clang/lib/Format/UnwrappedLineFormatter.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list