Before:
LooooooooooooooooongType
variable(nullptr, [](A *a) {});
After:
LooooooooooooooooongType
variable(nullptr, [](A *a) {});
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294358
91177308-0d34-0410-b5e6-
96231b3b80d8
}
}
- // Check whether parameter list can be long to a function declaration.
+ // Check whether parameter list can belong to a function declaration.
if (!Next || !Next->is(tok::l_paren) || !Next->MatchingParen)
return false;
// If the lines ends with "{", this is likely an function definition.
return true;
for (const FormatToken *Tok = Next->Next; Tok && Tok != Next->MatchingParen;
Tok = Tok->Next) {
+ if (Tok->is(tok::l_paren) && Tok->MatchingParen) {
+ Tok = Tok->MatchingParen;
+ continue;
+ }
if (Tok->is(tok::kw_const) || Tok->isSimpleTypeSpecifier() ||
Tok->isOneOf(TT_PointerOrReference, TT_StartOfName, tok::ellipsis))
return true;
" LoooooooooooooooooooooooooooooooooooooooongVariable({});");
verifyFormat("LoooooooooooooooooooooooooooooooooooooooongType\n"
" LoooooooooooooooooooooooooooooooooooooongVariable([A a]);");
+
+ // Lambdas should not confuse the variable declaration heuristic.
+ verifyFormat("LooooooooooooooooongType\n"
+ " variable(nullptr, [](A *a) {});",
+ getLLVMStyleWithColumns(40));
}
TEST_F(FormatTest, BreaksLongDeclarations) {