diff options
author | Krasimir Georgiev <krasimir@google.com> | 2017-07-20 22:29:39 +0000 |
---|---|---|
committer | Krasimir Georgiev <krasimir@google.com> | 2017-07-20 22:29:39 +0000 |
commit | 22d7e6b08daeff0a1c52cb9bdcb0b1e7e0766ee0 (patch) | |
tree | 3fd4da18c9cea67313ea754b48c3c80e89c1bacf /clang/lib/Format/ContinuationIndenter.cpp | |
parent | 9f1d5d8cd5231a6d9a2f0784e6cd6597836f58d9 (diff) | |
download | bcm5719-llvm-22d7e6b08daeff0a1c52cb9bdcb0b1e7e0766ee0.tar.gz bcm5719-llvm-22d7e6b08daeff0a1c52cb9bdcb0b1e7e0766ee0.zip |
[clang-format] Put '/**' and '*/' on own lines in multiline jsdocs
Reviewers: mprobst
Reviewed By: mprobst
Subscribers: cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D35683
llvm-svn: 308684
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 3bf1cd8f7c1..26dacf6562b 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -1314,6 +1314,7 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current, bool ReflowInProgress = false; unsigned Penalty = 0; unsigned RemainingTokenColumns = 0; + unsigned TailOffset = 0; for (unsigned LineIndex = 0, EndIndex = Token->getLineCount(); LineIndex != EndIndex; ++LineIndex) { BreakableToken::Split SplitBefore(StringRef::npos, 0); @@ -1322,7 +1323,7 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current, RemainingSpace, CommentPragmasRegex); } ReflowInProgress = SplitBefore.first != StringRef::npos; - unsigned TailOffset = + TailOffset = ReflowInProgress ? (SplitBefore.first + SplitBefore.second) : 0; if (!DryRun) Token->replaceWhitespaceBefore(LineIndex, RemainingTokenColumns, @@ -1379,6 +1380,16 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current, } } + BreakableToken::Split SplitAfterLastLine = Token->getSplitAfterLastLine( + TailOffset, ColumnLimit, CommentPragmasRegex); + if (SplitAfterLastLine.first != StringRef::npos) { + if (!DryRun) + Token->replaceWhitespaceAfterLastLine(TailOffset, SplitAfterLastLine, + Whitespaces); + RemainingTokenColumns = Token->getLineLengthAfterSplitAfterLastLine( + TailOffset, SplitAfterLastLine); + } + State.Column = RemainingTokenColumns; if (BreakInserted) { |