[clang-format] Fix regression about adding leading whitespace to the content of line comments
Summary:
The reflower didn't measure precisely the line column of a line in the middle of
a line comment section that has a prefix that needs to be adapted.
source:
```
/// a
//b
```
format before:
```
/// a
//b
```
format after:
```
/// a
// b
```
Reviewers: djasper
Reviewed By: djasper
Subscribers: sammccall, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D29329
llvm-svn: 293641
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 1097514..b316350 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1371,6 +1371,25 @@
format("//Even if it makes the line exceed the column limit",
getLLVMStyleWithColumns(51)));
EXPECT_EQ("//--But not here", format("//--But not here", getLLVMStyle()));
+ EXPECT_EQ("/// line 1\n"
+ "// add leading whitespace",
+ format("/// line 1\n"
+ "//add leading whitespace",
+ getLLVMStyleWithColumns(30)));
+ EXPECT_EQ("/// line 1\n"
+ "/// line 2\n"
+ "//! line 3\n"
+ "//! line 4\n"
+ "//! line 5\n"
+ "// line 6\n"
+ "// line 7",
+ format("///line 1\n"
+ "///line 2\n"
+ "//! line 3\n"
+ "//!line 4\n"
+ "//!line 5\n"
+ "// line 6\n"
+ "//line 7", getLLVMStyleWithColumns(20)));
EXPECT_EQ("// aa bb cc dd",
format("// aa bb cc dd ",