LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 41265 - Lambdas as the last argument of a function are indented too much if the function has many parameters
Summary: Lambdas as the last argument of a function are indented too much if the funct...
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: Formatter (show other bugs)
Version: 8.0
Hardware: PC All
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-27 13:34 PDT by Justin Bogner
Modified: 2019-03-28 08:46 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Bogner 2019-03-27 13:34:12 PDT
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;
  });