summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-01-11 11:00:58 +0000
committerDaniel Jasper <djasper@google.com>2016-01-11 11:00:58 +0000
commit2802456097eec57d663c9a53349eb408080ab7af (patch)
tree16c562be2b888bc7a376090483e230a0d9170555 /clang/lib/Format
parent524025bd2eed7cc5447fc112f409f3d23790fa72 (diff)
downloadbcm5719-llvm-2802456097eec57d663c9a53349eb408080ab7af.tar.gz
bcm5719-llvm-2802456097eec57d663c9a53349eb408080ab7af.zip
clang-format: [JS] Improve line-flow when calling functions on array literals.
Before: return [ aaaaaaaaaaaaaaaaaaaaaa ].aaaaaaa(function() { // }) .bbbbbb(); After: return [aaaaaaaaaaaaaaaaaaaaaa] .aaaaaaa(function() { // }) .bbbbbb(); llvm-svn: 257324
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index ff2569d41aa..cb5999e60ef 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -178,13 +178,15 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
return true;
unsigned NewLineColumn = getNewLineColumn(State);
- if (State.Column <= NewLineColumn)
- return false;
-
if (Current.isMemberAccess() &&
- State.Column + getLengthToNextOperator(Current) > Style.ColumnLimit)
+ State.Column + getLengthToNextOperator(Current) > Style.ColumnLimit &&
+ (State.Column > NewLineColumn ||
+ Current.NestingLevel < State.StartOfLineLevel))
return true;
+ if (State.Column <= NewLineColumn)
+ return false;
+
if (Style.AlwaysBreakBeforeMultilineStrings &&
(NewLineColumn == State.FirstIndent + Style.ContinuationIndentWidth ||
Previous.is(tok::comma) || Current.NestingLevel < 2) &&
OpenPOWER on IntegriCloud