summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2016-11-29 09:40:32 +0000
committerDaniel Jasper <djasper@google.com>2016-11-29 09:40:32 +0000
commit22ed262c239cac166d67bc30f3ee0aa45bb15745 (patch)
tree57f90ad46934a5c5ac176a2faefb52c5f62041fc /clang/lib/Format/ContinuationIndenter.cpp
parent35e4122f48e3492073210f91f15fc18b2f52c9f0 (diff)
downloadbcm5719-llvm-22ed262c239cac166d67bc30f3ee0aa45bb15745.tar.gz
bcm5719-llvm-22ed262c239cac166d67bc30f3ee0aa45bb15745.zip
clang-format: Wrap complex binary expressions on the RHS of a comma.
Specifically, if the RHS of a comma is a complex binary expression and spans multiple lines, insert a line break before it. This usually is often more readable compared to producing a hanging indent. See changes in FormatTest.cpp for examples. llvm-svn: 288120
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 2117a0ec93c..404e3a3b4ad 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -866,7 +866,7 @@ void ContinuationIndenter::moveStatePastFakeLParens(LineState &State,
// Exclude relational operators, as there, it is always more desirable to
// have the LHS 'left' of the RHS.
if (Previous && Previous->getPrecedence() != prec::Assignment &&
- Previous->isOneOf(TT_BinaryOperator, TT_ConditionalExpr) &&
+ Previous->isOneOf(TT_BinaryOperator, TT_ConditionalExpr, tok::comma) &&
Previous->getPrecedence() != prec::Relational) {
bool BreakBeforeOperator =
Previous->is(tok::lessless) ||
OpenPOWER on IntegriCloud