[llvm-bugs] [Bug 41265] New: Lambdas as the last argument of a function are indented too much if the function has many parameters

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 27 13:34:12 PDT 2019


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

            Bug ID: 41265
           Summary: Lambdas as the last argument of a function are
                    indented too much if the function has many parameters
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm-bugs at justinbogner.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

The coding standards doc states to format lambdas like blocks as long as
they're the last arg:

 
http://www.llvm.org/docs/CodingStandards.html#format-lambdas-like-blocks-of-code

However, clang-format only seems to do that if the opening brace of the lambda
is on the same line as the start of the function call:

  some_call_to_a_function_with_a_long_name(arg1, arg2, [](int x) {
    int y = x * x;
    return y;
  });

vs

  some_call_to_a_function_with_a_long_name(long_arg1, really_long_arg2,
                                           [](int x) {
                                             int y = x * x;
                                             return y;
                                           });

The latter should really be:

  some_call_to_a_function_with_a_long_name(long_arg1, really_long_arg2,
                                           [](int x) {
    int y = x * x;
    return y;
  });

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190327/26ac4222/attachment.html>


More information about the llvm-bugs mailing list