Always break before the colon in constructor initializers, when
BreakConstructorInitializersBeforeComma is true.
This option is used in WebKit style, so this also ensures initializer lists are
not put on a single line, as per the WebKit coding guidelines.
Patch by Florian Sowade!
llvm-svn: 197386
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 87c2fd7..8661927 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -455,13 +455,12 @@
/// \brief Formats the line starting at \p State, simply keeping all of the
/// input's line breaking decisions.
- void format(unsigned FirstIndent, const AnnotatedLine *Line,
- bool LineIsMerged) {
+ void format(unsigned FirstIndent, const AnnotatedLine *Line) {
LineState State =
Indenter->getInitialState(FirstIndent, Line, /*DryRun=*/false);
while (State.NextToken != NULL) {
bool Newline =
- (!LineIsMerged && Indenter->mustBreak(State)) ||
+ Indenter->mustBreak(State) ||
(Indenter->canBreak(State) && State.NextToken->NewlinesBefore > 0);
Indenter->addTokenToState(State, Newline, /*DryRun=*/false);
}
@@ -728,8 +727,7 @@
// FIXME: Implement nested blocks for ColumnLimit = 0.
NoColumnLimitFormatter Formatter(Indenter);
if (!DryRun)
- Formatter.format(Indent, &TheLine,
- /*LineIsMerged=*/MergedLines > 0);
+ Formatter.format(Indent, &TheLine);
} else {
Penalty += format(TheLine, Indent, DryRun);
}