Token.reset(new BreakableStringLiteral(Current, StartColumn,
Line.InPPDirective, Encoding));
- } else if (Current.Type == TT_BlockComment) {
+ } else if (Current.Type == TT_BlockComment && Current.isTrailingComment()) {
Token.reset(new BreakableBlockComment(
Style, Current, StartColumn, OriginalStartColumn, !Current.Previous,
Line.InPPDirective, Encoding));
getLLVMStyleWithColumns(40)));
}
+TEST_F(FormatTest, DontBreakNonTrailingBlockComments) {
+ EXPECT_EQ("void\n"
+ "ffffffffff(int aaaaa /* test */);",
+ format("void ffffffffff(int aaaaa /* test */);",
+ getLLVMStyleWithColumns(35)));
+}
+
TEST_F(FormatTest, SplitsLongCxxComments) {
EXPECT_EQ("// A comment that\n"
"// doesn't fit on\n"