[clang-format] Fix regression merging comments across newlines.
Summary:
This fixes a regression that causes example:
```
enum A {
a, // line a
// line b
b
};
```
to be formatted as follows:
```
enum A {
a, // line a
// line b
b
};
```
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: cfe-commits, sammccall, djasper, klimek
Differential Revision: https://reviews.llvm.org/D29322
llvm-svn: 293624
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 7348fa0..fb77006 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -934,6 +934,24 @@
" VAL_B\n"
"};");
+ EXPECT_EQ("enum A {\n"
+ " // line a\n"
+ " a,\n"
+ " b, // line b\n"
+ "\n"
+ " // line c\n"
+ " c\n"
+ "};",
+ format("enum A {\n"
+ " // line a\n"
+ " a,\n"
+ " b, // line b\n"
+ "\n"
+ " // line c\n"
+ " c\n"
+ "};",
+ getLLVMStyleWithColumns(20)));
+
verifyFormat(
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa =\n"
" bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb; // Trailing comment");