summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-01-12 19:35:26 +0000
committerDaniel Jasper <djasper@google.com>2017-01-12 19:35:26 +0000
commitd1a9d8acdf8a1f7143873095fc37ad305d286895 (patch)
treec296dd6b61ee022da39c8763e1493315f144a824 /clang/lib
parent6bdf92cec7b37eea163885ef6a6324019c1da93f (diff)
downloadbcm5719-llvm-d1a9d8acdf8a1f7143873095fc37ad305d286895.tar.gz
bcm5719-llvm-d1a9d8acdf8a1f7143873095fc37ad305d286895.zip
clang-format: Treat braced lists like other complex parameters.
Specifically, wrap before them if they are multi-line so that we don't create long hanging indents. This prevents having a lot of code indented a lot in some cases. Before: someFunction(Param, {List1, List2, List3}); After: someFunction(Param, {List1, List2, List3}); llvm-svn: 291801
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index bf075ab6d53..5a30370af86 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -930,6 +930,13 @@ void ContinuationIndenter::moveStatePastScopeOpener(LineState &State,
return;
}
+ const FormatToken *Previous = Current.getPreviousNonComment();
+ if (Previous && Previous->is(tok::comma) &&
+ !Previous->is(TT_OverloadedOperator)) {
+ if (!Newline)
+ State.Stack.back().NoLineBreak = true;
+ }
+
unsigned NewIndent;
unsigned NewIndentLevel = State.Stack.back().IndentLevel;
unsigned LastSpace = State.Stack.back().LastSpace;
OpenPOWER on IntegriCloud