[clang-format] Fix reflow in block comment lines with leading whitespace.
Summary:
The reflower was not taking into account the additional leading whitespace in block comment lines.
source:
```
{
/*
* long long long long
* long
* long long long long
*/
}
```
format (with column limit 20) before:
```
{
/*
* long long long
* long long long long
* long long
*/
}
```
format after:
```
{
/*
* long long long
* long long long
* long long long
*/
}
```
Reviewers: djasper, klimek
Reviewed By: djasper
Subscribers: cfe-commits, sammccall, klimek
Differential Revision: https://reviews.llvm.org/D29326
llvm-svn: 293633
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index fb77006..1097514 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1960,6 +1960,23 @@
" * longg */",
getLLVMStyleWithColumns(20)));
+ // Reflow lines with leading whitespace.
+ EXPECT_EQ("{\n"
+ " /*\n"
+ " * long long long\n"
+ " * long long long\n"
+ " * long long long\n"
+ " */\n"
+ "}",
+ format("{\n"
+ "/*\n"
+ " * long long long long\n"
+ " * long\n"
+ " * long long long long\n"
+ " */\n"
+ "}",
+ getLLVMStyleWithColumns(20)));
+
// Break single line block comments that are first in the line with ' *'
// decoration.
EXPECT_EQ("/* long long long\n"