summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-06-04 12:40:57 +0000
committerDaniel Jasper <djasper@google.com>2014-06-04 12:40:57 +0000
commita69ca9be127f26e22053243f7562d1079339314f (patch)
tree292fc64d2f53004064e8380d5e5182ef01894d65 /clang/lib
parent5d8d72c5df0b7b80b30a2d66acb7a03b7933bdc6 (diff)
downloadbcm5719-llvm-a69ca9be127f26e22053243f7562d1079339314f.tar.gz
bcm5719-llvm-a69ca9be127f26e22053243f7562d1079339314f.zip
clang-format: Leave empty lines within UnwrappedLines.
These are commonly used to structure things like enums or long braced lists. There doesn't seem to be a good reason to have the behavior in such structures be different from the behavior between statements. llvm-svn: 210183
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp6
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 5e63d0cb9be..308fc623d82 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -413,10 +413,8 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State,
State.Stack.back().BreakBeforeParameter = true;
if (!DryRun) {
- unsigned Newlines = 1;
- if (Current.is(tok::comment))
- Newlines = std::max(Newlines, std::min(Current.NewlinesBefore,
- Style.MaxEmptyLinesToKeep + 1));
+ unsigned Newlines = std::max(
+ 1u, std::min(Current.NewlinesBefore, Style.MaxEmptyLinesToKeep + 1));
Whitespaces.replaceWhitespace(Current, Newlines,
State.Stack.back().IndentLevel, State.Column,
State.Column, State.Line->InPPDirective);
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index cbb9d7f9643..a61c6b880d5 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1591,6 +1591,8 @@ static bool isAllmanBrace(const FormatToken &Tok) {
bool TokenAnnotator::mustBreakBefore(const AnnotatedLine &Line,
const FormatToken &Right) {
const FormatToken &Left = *Right.Previous;
+ if (Right.NewlinesBefore > 1)
+ return true;
if (Right.is(tok::comment)) {
return Right.Previous->BlockKind != BK_BracedInit &&
Right.Previous->Type != TT_CtorInitializerColon &&
OpenPOWER on IntegriCloud