summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2017-01-31 13:32:38 +0000
committerKrasimir Georgiev <krasimir@google.com>2017-01-31 13:32:38 +0000
commit753625b62e2bd6ce5873ce15972b3c3fba8ff6c0 (patch)
tree6a43eddb7b6b0aa355976891209a606e4a544d33 /clang/lib/Format/UnwrappedLineParser.cpp
parent6f033f0c30bd0b82ace89a7ef5fb7be3fc52c0b3 (diff)
downloadbcm5719-llvm-753625b62e2bd6ce5873ce15972b3c3fba8ff6c0.tar.gz
bcm5719-llvm-753625b62e2bd6ce5873ce15972b3c3fba8ff6c0.zip
[clang-format] Fix regression merging comments across newlines.
Summary: This fixes a regression that causes example: ``` enum A { a, // line a // line b b }; ``` to be formatted as follows: ``` enum A { a, // line a // line b b }; ``` Reviewers: djasper, klimek Reviewed By: klimek Subscribers: cfe-commits, sammccall, djasper, klimek Differential Revision: https://reviews.llvm.org/D29322 llvm-svn: 293624
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index c10a13f39e0..a96d4d9be3e 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2124,7 +2124,12 @@ void UnwrappedLineParser::flushComments(bool NewlineBeforeNext) {
I != E; ++I) {
// Line comments that belong to the same line comment section are put on the
// same line since later we might want to reflow content between them.
- // See BreakableToken.
+ // Additional fine-grained breaking of line comment sections is controlled
+ // by the class BreakableLineCommentSection in case it is desirable to keep
+ // several line comment sections in the same unwrapped line.
+ //
+ // FIXME: Consider putting separate line comment sections as children to the
+ // unwrapped line instead.
if (isOnNewLine(**I) && JustComments && !continuesLineComment(**I, *Line))
addUnwrappedLine();
pushToken(*I);
OpenPOWER on IntegriCloud