Before:
DEBUG( //
{ f(); });
After:
DEBUG( //
{ f(); });
Also add additional test to selected formatting of individual statements
in nested blocks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195952
91177308-0d34-0410-b5e6-
96231b3b80d8
Penalty += Style.PenaltyBreakFirstLessLess;
if (Current.is(tok::l_brace) && Current.BlockKind == BK_Block) {
- State.Column = State.FirstIndent;
+ State.Column =
+ State.ParenLevel == 0 ? State.FirstIndent : State.Stack.back().Indent;
} else if (Current.isOneOf(tok::r_brace, tok::r_square)) {
if (Current.closesBlockTypeList(Style) ||
(Current.MatchingParen &&
" somethingelse();\n"
"});",
getLLVMStyleWithColumns(40));
+ verifyFormat("DEBUG( //\n"
+ " { f(); }, a);");
+ verifyFormat("DEBUG( //\n"
+ " {\n"
+ " f(); //\n"
+ " },\n"
+ " a);");
+
EXPECT_EQ("call(parameter, {\n"
" something();\n"
" // Comment too\n"
" int j;\n"
"} ) ;",
41, 1, getLLVMStyle()));
+ EXPECT_EQ("DEBUG( {\n"
+ " int i;\n"
+ " int j;\n"
+ "} ) ;",
+ format("DEBUG( {\n"
+ " int i;\n"
+ " int j;\n"
+ "} ) ;",
+ 41, 1, getLLVMStyle()));
EXPECT_EQ("DEBUG({\n"
" int i;\n"
" int j;\n"