summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-03-08 08:55:12 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-03-08 08:55:12 +0000
commit17725d8391739cfb54e626336cdeb4843de5d5d2 (patch)
treed64cbfd57efadce89a68e196dc5733fa6e61d27d /clang/lib/Format/ContinuationIndenter.cpp
parente0ec12984b6c37f640fa328abb81edb9f0d4eaf1 (diff)
downloadbcm5719-llvm-17725d8391739cfb54e626336cdeb4843de5d5d2.tar.gz
bcm5719-llvm-17725d8391739cfb54e626336cdeb4843de5d5d2.zip
[clang-format] Enable comment reflowing in multiline comments containing pragmas
Summary: This patch enables comment reflowing of lines not matching the comment pragma regex in multiline comments containing comment pragma lines. Previously, these comments were dumped without being reindented to the result. Reviewers: djasper, mprobst Reviewed By: mprobst Subscribers: klimek, mprobst, cfe-commits Differential Revision: https://reviews.llvm.org/D30697 llvm-svn: 297261
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index feba08e0f0a..b887df7c554 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -1183,7 +1183,6 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current,
}
} else if (Current.is(TT_BlockComment)) {
if (!Current.isTrailingComment() || !Style.ReflowComments ||
- CommentPragmasRegex.match(Current.TokenText.substr(2)) ||
// If a comment token switches formatting, like
// /* clang-format on */, we don't want to break it further,
// but we may still want to adjust its indentation.
@@ -1234,8 +1233,8 @@ unsigned ContinuationIndenter::breakProtrudingToken(const FormatToken &Current,
RemainingTokenColumns = Token->getLineLengthAfterSplitBefore(
LineIndex, TailOffset, RemainingTokenColumns, ColumnLimit, SplitBefore);
while (RemainingTokenColumns > RemainingSpace) {
- BreakableToken::Split Split =
- Token->getSplit(LineIndex, TailOffset, ColumnLimit);
+ BreakableToken::Split Split = Token->getSplit(
+ LineIndex, TailOffset, ColumnLimit, CommentPragmasRegex);
if (Split.first == StringRef::npos) {
// The last line's penalty is handled in addNextStateToQueue().
if (LineIndex < EndIndex - 1)
OpenPOWER on IntegriCloud