[PATCH] D102706: [clang-format] Add new LambdaBodyIndentation option

Vitali Lovich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 18 11:25:57 PDT 2021


vlovich created this revision.
vlovich added reviewers: MyDeveloperDay, curdeius.
vlovich added a project: clang-format.
vlovich requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102706

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/Format.cpp
  clang/lib/Format/UnwrappedLineFormatter.cpp
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102706.346223.patch
Type: text/x-patch
Size: 9313 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210518/edf151b2/attachment.bin>


More information about the cfe-commits mailing list