Skip to content

clang-format LambdaBodyIndentation=OuterScope doesn't work correctly with BraceWrapping.BeforeLambdaBody=1 #59954

@eugeneko

Description

@eugeneko

When I use LambdaBodyIndentation=OuterScope with BraceWrapping.BeforeLambdaBody=1, brace is over-indented.
Here is the inputs and outputs.

# .clang-format
---
Language: Cpp

BraceWrapping:
  BeforeLambdaBody: true
BreakBeforeBraces: Custom
LambdaBodyIndentation: OuterScope
// input.cpp
int main()
{
	foo();
	bar([]() {foo(); foo();});
}
// output.cpp
int main() {
  foo();
  bar(
      []()
      { //< the fuck
    foo();
    foo();
  });
}

I would expect this:

// output.cpp
int main() {
  foo();
  bar(
      []()
  {
    foo();
    foo();
  });
}

clang-format version 15.0.3 (https://github.com/llvm/llvm-project 4a2c05b)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions