summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/ContinuationIndenter.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-02-20 12:43:48 +0000
committerDaniel Jasper <djasper@google.com>2017-02-20 12:43:48 +0000
commitd9b319e3e3b9aa77741e70480c4ce41094ff3a85 (patch)
tree8f10ec1cb6d09f31b3768885ba92958c3c9b1551 /clang/lib/Format/ContinuationIndenter.cpp
parent3d934d366ea84054e5c5693793e2035e6187a28a (diff)
downloadbcm5719-llvm-d9b319e3e3b9aa77741e70480c4ce41094ff3a85.tar.gz
bcm5719-llvm-d9b319e3e3b9aa77741e70480c4ce41094ff3a85.zip
clang-format: Prevent weird line-wraps in complex lambda introducers
Before: aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]() -> ::std:: unordered_set<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> { // }); After: aaaaaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa( [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa]() -> ::std::unordered_set< aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa> { // }); llvm-svn: 295659
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r--clang/lib/Format/ContinuationIndenter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp
index 173ca17c2a3..8a28e630dbc 100644
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -810,6 +810,8 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
if (Current.isOneOf(TT_BinaryOperator, TT_ConditionalExpr) && Newline)
State.Stack.back().NestedBlockIndent =
State.Column + Current.ColumnWidth + 1;
+ if (Current.isOneOf(TT_LambdaLSquare, TT_LambdaArrow))
+ State.Stack.back().LastSpace = State.Column;
// Insert scopes created by fake parenthesis.
const FormatToken *Previous = Current.getPreviousNonComment();
OpenPOWER on IntegriCloud