https://bugs.llvm.org/show_bug.cgi?id=39688

            Bug ID: 39688
           Summary: AlignAfterOpen: Align does not align body of lambda as
                    function param with following params
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

Behavior is identical on clang-format versions 5,6,7

When a lambda is passed as a function argument and is opened on the same line
as the function's open paren, the lambda body is not aligned with the rest of
the arguments.  This makes sense when the lambda is the final argument, but not
with following args.


input.cpp / expected output:
{
  test_long_function([&] {
                       if (true) {
                         dothis();
                       } else {
                         dothat();
                       }
                     },
                     secondArg);

}


ouput.cpp / actual output:
{
  test_long_function([&] {
    if (true) {
      dothis();
    } else {
      dothat();
    }
  },
                     secondArg);
}


.clang-format:
---
ColumnLimit:     0
AlignAfterOpenBracket: Align



note, if the lambda is not on the same line as the open paren, it formats as
expected:

{
  test_long_function(firstarg,
                     [&] {
                       if (condition()) {
                         dothis();
                       } else {
                         dothat();
                       }
                     },
                     thirdarg);
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to