clang-format: Improve format of lambdas in ctor initializers.
Before: Constructor() : Constructor([] { // comment int i; }) {} After: Constructor() : Constructor([] { // comment int i; }) {} llvm-svn: 225625
This commit is contained in:
parent
19acc3d351
commit
d6a1cab1bc
|
@ -632,6 +632,7 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
|
|||
// ^ line up here.
|
||||
State.Stack.back().Indent =
|
||||
State.Column + (Style.BreakConstructorInitializersBeforeComma ? 0 : 2);
|
||||
State.Stack.back().NestedBlockIndent = State.Stack.back().Indent;
|
||||
if (Style.ConstructorInitializerAllOnOneLineOrOnePerLine)
|
||||
State.Stack.back().AvoidBinPacking = true;
|
||||
State.Stack.back().BreakBeforeParameter = false;
|
||||
|
|
|
@ -9380,6 +9380,10 @@ TEST_F(FormatTest, FormatsLambdas) {
|
|||
verifyFormat("string abc = SomeFunction(aaaaaaaaaaaaa, aaaaa, []() {\n"
|
||||
" SomeOtherFunctioooooooooooooooooooooooooon();\n"
|
||||
"});");
|
||||
verifyFormat("Constructor()\n"
|
||||
" : Field([] { // comment\n"
|
||||
" int i;\n"
|
||||
" }) {}");
|
||||
|
||||
// Lambdas with return types.
|
||||
verifyFormat("int c = []() -> int { return 2; }();\n");
|
||||
|
|
Loading…
Reference in New Issue