[PATCH] D44609: [Clang-Format] New option BreakBeforeLambdaBody to manage lambda line break inside function parameter call

Francois JEAN via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 18 10:42:17 PDT 2018


Wawha created this revision.
Herald added subscribers: cfe-commits, klimek.

This is a patch to fix the problem identify by this bug: https://bugs.llvm.org/show_bug.cgi?id=27640.

When formatting this code with option "BreakBeforeBraces: Allman", the lambda body are not put entirely on new lines if the lambda is inside a function call.
Here an example of the current formatting in "allman":

  connect([]() {
    foo();
    bar();
  });

We the new option, the formatting is like that:

  connect(
    []()
    {
      foo();
      bar();
    });

It's my first patch for this project, so if I made some mistake, do not hesitate to explain me that is wrong.
I write few test to check that the new option work and check that there is no regression.

This patch should also meet the request of this bug/request: https://bugs.llvm.org//show_bug.cgi?id=32151


Repository:
  rC Clang

https://reviews.llvm.org/D44609

Files:
  include/clang/Format/Format.h
  lib/Format/ContinuationIndenter.cpp
  lib/Format/Format.cpp
  lib/Format/TokenAnnotator.cpp
  lib/Format/TokenAnnotator.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44609.138856.patch
Type: text/x-patch
Size: 5521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180318/b5ffa1e1/attachment.bin>


More information about the cfe-commits mailing list