spaceRequiredBefore(Line, *Current) ? 1 : 0;
if (Current->MustBreakBefore) {
- } else if (Current->Type == TT_LineComment) {
+ } else if (Current->is(tok::comment)) {
Current->MustBreakBefore = Current->NewlinesBefore > 0;
} else if (Current->Previous->isTrailingComment() ||
(Current->is(tok::string_literal) &&
" // Comment after empty line\n"
" b\n"
"}"));
- EXPECT_EQ("S s = { a, b };", format("S s = {\n"
- " a,\n"
- "\n"
- " b\n"
- "};"));
+ EXPECT_EQ("S s = {\n"
+ " /* Some comment */\n"
+ " a,\n"
+ "\n"
+ " /* Comment after empty line */\n"
+ " b\n"
+ "}",
+ format("S s = {\n"
+ " /* Some comment */\n"
+ " a,\n"
+ " \n"
+ " /* Comment after empty line */\n"
+ " b\n"
+ "}"));
verifyFormat("const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = {\n"
" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment\n"
" 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment\n"
verifyFormat("static int LooooooooooooooooooooooooongVariable[1] = {\n"
" 100000000000000000000000\n"
"};");
+ EXPECT_EQ("S s = { a, b };", format("S s = {\n"
+ " a,\n"
+ "\n"
+ " b\n"
+ "};"));
// FIXME: This would fit into the column limit if we'd fit "{ {" on the first
// line. However, the formatting looks a bit off and this probably doesn't
EXPECT_EQ("a = {\n"
" 1111 /* */\n"
"};",
- format("a = {1111\n"
- "/* */\n"
+ format("a = {1111 /* */\n"
"};",
getLLVMStyleWithColumns(15)));
EXPECT_EQ("a = {\n"
" 1111 /* */\n"
"};",
- format("a = {1111\n"
- "/* */\n"
+ format("a = {1111 /* */\n"
"};",
getLLVMStyleWithColumns(15)));
" 1111 /* a\n"
" */\n"
"};",
- format("a = {1111\n"
- "/* a */\n"
+ format("a = {1111 /* a */\n"
"};",
getLLVMStyleWithColumns(15)));
}