// Any break on this level means that the parent level has been broken
// and we need to avoid bin packing there.
bool NestedBlockSpecialCase =
+ Style.Language != FormatStyle::LK_Cpp &&
Current.is(tok::r_brace) && State.Stack.size() > 1 &&
State.Stack[State.Stack.size() - 2].NestedBlockInlined;
if (!NestedBlockSpecialCase)
Left.is(tok::kw_operator))
return false;
if (Left.is(tok::equal) && !Right.isOneOf(tok::kw_default, tok::kw_delete) &&
- Line.Type == LT_VirtualFunctionDecl)
+ Line.Type == LT_VirtualFunctionDecl && Left.NestingLevel == 0)
return false;
if (Left.is(tok::l_paren) && Left.is(TT_AttributeParen))
return false;
" int i;\n"
" int j;\n"
"});");
- verifyFormat("functionCall({\n"
- " int i;\n"
- " int j;\n"
- "}, aaaa, bbbb, cccc);");
+ verifyFormat("functionCall(\n"
+ " {\n"
+ " int i;\n"
+ " int j;\n"
+ " },\n"
+ " aaaa, bbbb, cccc);");
verifyFormat("functionA(functionB({\n"
" int i;\n"
" int j;\n"
"});");
FormatStyle Style = getGoogleStyle();
Style.ColumnLimit = 45;
- verifyFormat("Debug(aaaaa, {\n"
- " if (aaaaaaaaaaaaaaaaaaaaaaaa) return;\n"
- "}, a);",
+ verifyFormat("Debug(aaaaa,\n"
+ " {\n"
+ " if (aaaaaaaaaaaaaaaaaaaaaaaa) return;\n"
+ " },\n"
+ " a);",
Style);
verifyFormat("SomeFunction({MACRO({ return output; }), b});");
"};",
Tab);
verifyFormat("{\n"
- "\tQ({\n"
- "\t\tint a;\n"
- "\t\tsomeFunction(aaaaaaaa,\n"
- "\t\t bbbbbbb);\n"
- "\t}, p);\n"
+ "\tQ(\n"
+ "\t {\n"
+ "\t\t int a;\n"
+ "\t\t someFunction(aaaaaaaa,\n"
+ "\t\t bbbbbbb);\n"
+ "\t },\n"
+ "\t p);\n"
"}",
Tab);
EXPECT_EQ("{\n"
verifyFormat("SomeFunction({[&] {\n"
" // comment\n"
"}});");
+ verifyFormat("virtual aaaaaaaaaaaaaaaa(std::function<bool()> bbbbbbbbbbbb =\n"
+ " [&]() { return true; },\n"
+ " aaaaa aaaaaaaaa);");
// Lambdas with return types.
verifyFormat("int c = []() -> int { return 2; }();\n");