forked from OSchip/llvm-project
clang-format: Prefer not to put lambdas on a single line.
Before: string abc = SomeFunction(aaaaaaaaaaaaa, aaaaa, []() { SomeOtherFunctioooooooooooooooooooooooooon(); }); After: string abc = SomeFunction(aaaaaaaaaaaaa, aaaaa, []() { SomeOtherFunctioooooooooooooooooooooooooon(); }); llvm-svn: 215197
This commit is contained in:
parent
b911bf84dc
commit
a5621202c4
|
@ -1420,6 +1420,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
|||
return 100;
|
||||
if (Left.is(tok::equal) && InFunctionDecl)
|
||||
return 110;
|
||||
if (Right.is(tok::r_brace))
|
||||
return 1;
|
||||
if (Left.opensScope())
|
||||
return Left.ParameterCount > 1 ? Style.PenaltyBreakBeforeFirstCallParameter
|
||||
: 19;
|
||||
|
|
|
@ -8819,6 +8819,9 @@ TEST_F(FormatTest, FormatsLambdas) {
|
|||
"}");
|
||||
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
|
||||
" [](const aaaaaaaaaa &a) { return a; });");
|
||||
verifyFormat("string abc = SomeFunction(aaaaaaaaaaaaa, aaaaa, []() {\n"
|
||||
" SomeOtherFunctioooooooooooooooooooooooooon();\n"
|
||||
"});");
|
||||
|
||||
// Lambdas with return types.
|
||||
verifyFormat("int c = []() -> int { return 2; }();\n");
|
||||
|
|
Loading…
Reference in New Issue