Fix crasher when formatting certain block comments.
Smallest reproduction:
/*
**
*/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182913 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/BreakableToken.cpp b/lib/Format/BreakableToken.cpp
index 5c3ad9c..10ba1f3 100644
--- a/lib/Format/BreakableToken.cpp
+++ b/lib/Format/BreakableToken.cpp
@@ -337,6 +337,11 @@
// contain a trailing whitespace.
Prefix = Prefix.substr(0, 1);
}
+ } else {
+ if (StartOfLineColumn[LineIndex] == 1) {
+ // This lines starts immediately after the decorating *.
+ Prefix = Prefix.substr(0, 1);
+ }
}
unsigned WhitespaceOffsetInToken =