summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-06-08 09:45:08 +0000
committerDaniel Jasper <djasper@google.com>2016-06-08 09:45:08 +0000
commitacadc8e0d64e90cded8f63a154ab3111a1d294f9 (patch)
tree62458aadb6d0fdc3ef1d298cea33673af93942a6 /clang/lib
parent2b4d6eae395103b34fe8c9eaf68017a79b72e88b (diff)
downloadbcm5719-llvm-acadc8e0d64e90cded8f63a154ab3111a1d294f9.tar.gz
bcm5719-llvm-acadc8e0d64e90cded8f63a154ab3111a1d294f9.zip
clang-format: Fix incorrect calculation of "length" of /**/ comments.
This could lead to column limit violations. llvm-svn: 272125
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index a0aed0dab47..7f88eea4060 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1046,6 +1046,9 @@ void ContinuationIndenter::moveStateToNewBlock(LineState &State) {
unsigned ContinuationIndenter::addMultilineToken(const FormatToken &Current,
LineState &State) {
+ if (!Current.IsMultiline)
+ return 0;
+
// Break before further function parameters on all levels.
for (unsigned i = 0, e = State.Stack.size(); i != e; ++i)
State.Stack[i].BreakBeforeParameter = true;
@@ -1125,10 +1128,10 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current,
} else {
return 0;
}
- } else if (Current.is(TT_BlockComment) && Current.isTrailingComment()) {
- if (!Style.ReflowComments ||
+ } else if (Current.is(TT_BlockComment)) {
+ if (!Current.isTrailingComment() || !Style.ReflowComments ||
CommentPragmasRegex.match(Current.TokenText.substr(2)))
- return 0;
+ return addMultilineToken(Current, State);
Token.reset(new BreakableBlockComment(
Current, State.Line->Level, StartColumn, Current.OriginalColumn,
!Current.Previous, State.Line->InPPDirective, Encoding, Style));
OpenPOWER on IntegriCloud