if (static_cast<int>(LevelIndent) - Offset >= 0)
LevelIndent -= Offset;
- if (Tok->isNot(tok::comment) && !TheLine.InPPDirective)
+ if ((Tok->isNot(tok::comment) ||
+ IndentForLevel[TheLine.Level] == -1) &&
+ !TheLine.InPPDirective)
IndentForLevel[TheLine.Level] = LevelIndent;
} else if (!DryRun) {
Whitespaces->addUntouchableToken(*Tok, TheLine.InPPDirective);
" int a; //\n"
"});",
0, 0, getLLVMStyle()));
+ EXPECT_EQ("someFunction(\n"
+ " [] {\n"
+ " // Only with this comment.\n"
+ " int i; // invoke formatting here.\n"
+ " }, // force line break\n"
+ " aaa);",
+ format("someFunction(\n"
+ " [] {\n"
+ " // Only with this comment.\n"
+ " int i; // invoke formatting here.\n"
+ " }, // force line break\n"
+ " aaa);",
+ 63, 1, getLLVMStyle()));
}
TEST_F(FormatTest, PutEmptyBlocksIntoOneLine) {