summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2013-12-16 14:35:51 +0000
committerAlexander Kornienko <alexfh@google.com>2013-12-16 14:35:51 +0000
commita594ba8a76c75c0ec293cfae028bd45c093bae2c (patch)
tree538b8d36d35776c61945a02a70ba3d1adf61e27e /clang/lib/Format/ContinuationIndenter.cpp
parente8323a88ea252a0b16f2d54a129cfc8ac7ab744c (diff)
downloadbcm5719-llvm-a594ba8a76c75c0ec293cfae028bd45c093bae2c.tar.gz
bcm5719-llvm-a594ba8a76c75c0ec293cfae028bd45c093bae2c.zip
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
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index e63f72d65e6..e8dc8d4a7f1 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -183,9 +183,12 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
Current.LongestObjCSelectorName == 0 &&
State.Stack.back().BreakBeforeParameter)
return true;
- if ((Current.Type == TT_CtorInitializerColon ||
- (Previous.ClosesTemplateDeclaration && State.ParenLevel == 0 &&
- !Current.isTrailingComment())))
+ if (Current.Type == TT_CtorInitializerColon &&
+ (!Style.AllowShortFunctionsOnASingleLine ||
+ Style.BreakConstructorInitializersBeforeComma || Style.ColumnLimit != 0))
+ return true;
+ if (Previous.ClosesTemplateDeclaration && State.ParenLevel == 0 &&
+ !Current.isTrailingComment())
return true;
if ((Current.Type == TT_StartOfName || Current.is(tok::kw_operator)) &&
OpenPOWER on IntegriCloud