aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Format/Format.cpp8
-rw-r--r--lib/Format/TokenAnnotator.cpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 7687aa347b..8bc414cd02 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -518,9 +518,11 @@ private:
State.Stack.back().BreakBeforeParameter = false;
if (!DryRun) {
- unsigned NewLines =
- std::max(1u, std::min(Current.FormatTok.NewlinesBefore,
- Style.MaxEmptyLinesToKeep + 1));
+ unsigned NewLines = 1;
+ if (Current.Type == TT_LineComment)
+ NewLines =
+ std::max(NewLines, std::min(Current.FormatTok.NewlinesBefore,
+ Style.MaxEmptyLinesToKeep + 1));
if (!Line.InPPDirective)
Whitespaces.replaceWhitespace(Current, NewLines, State.Column,
WhitespaceStartColumn, Style);
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 86daa8d60e..08290b905a 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -842,8 +842,6 @@ void TokenAnnotator::calculateFormattingInformation(AnnotatedLine &Line) {
Current->Parent->is(tok::string_literal) &&
Current->Children[0].is(tok::string_literal)) {
Current->MustBreakBefore = true;
- } else if (Current->FormatTok.NewlinesBefore > 1) {
- Current->MustBreakBefore = true;
} else {
Current->MustBreakBefore = false;
}