clang-format: Fix bug in column-layout formatting.
Specific arrangements of comments after trailing commas could confuse
the column width calculation, e.g. in:
vector<int> x = { a, b,
/* some */ /* comment */ };
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189211 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 5606aa1..fed054d 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -3530,7 +3530,7 @@
" bbbbbb);");
}
-TEST_F(FormatTest, UndestandsOverloadedOperators) {
+TEST_F(FormatTest, UnderstandsOverloadedOperators) {
verifyFormat("bool operator<();");
verifyFormat("bool operator>();");
verifyFormat("bool operator=();");
@@ -4191,6 +4191,10 @@
" 1, 1, 1, 1, 1, 1, 1, 1, //\n"
"};",
getLLVMStyleWithColumns(39));
+ verifyFormat("vector<int> x = { 1, 1, 1, 1,\n"
+ " 1, 1, 1, 1,\n"
+ " /**/ /**/ };",
+ getLLVMStyleWithColumns(39));
}
TEST_F(FormatTest, PullTrivialFunctionDefinitionsIntoSingleLine) {