[PATCH] D52676: [clang-format] tweaked another case of lambda formatting

Krasimir Georgiev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 1 10:59:12 PDT 2018


krasimir added a comment.

Digging a bit further, seems like the behavior you're looking for could be achieved by setting the `AlignAfterOpenBracket` option to `DontAlign` or `AlwaysBreak`:

  % clang-format -style='{BasedOnStyle: google, AlignAfterOpenBracket: AlwaysBreak}' test.cc
  void f() {
    something->Method2s(
        1,
        [this] {
          Do1();
          Do2();
        },
        1);
  }
  % clang-format -style='{BasedOnStyle: google, AlignAfterOpenBracket: DontAlign}' test.cc
  void f() {
    something->Method2s(1,
        [this] {
          Do1();
          Do2();
        },
        1);
  }

Does this work for you?

I don't think modifying the behavior as posed in this change based on the existence of multiline lambdas and the value of the `BinPackArguments` option is better than what we have now, especially when `AlignAfterOpenBracket=Align`.


Repository:
  rC Clang

https://reviews.llvm.org/D52676





More information about the cfe-commits mailing list