clang-format: Fix parsing and indenting lambdas.
Before:
void f() {
other(x.begin(), x.end(), //
[&](int, int) { return 1; });
}
After:
void f() {
other(x.begin(), x.end(), //
[&](int, int) { return 1; });
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190039 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp
index f9219cb..c47d799 100644
--- a/lib/Format/ContinuationIndenter.cpp
+++ b/lib/Format/ContinuationIndenter.cpp
@@ -267,7 +267,8 @@
State.Column = State.Stack.back().Indent;
State.Stack.back().ColonPos = State.Column + Current.CodePointCount;
}
- } else if (Current.is(tok::l_square) && Current.Type != TT_ObjCMethodExpr) {
+ } else if (Current.is(tok::l_square) && Current.Type != TT_ObjCMethodExpr &&
+ Current.Type != TT_LambdaLSquare) {
if (State.Stack.back().StartOfArraySubscripts != 0)
State.Column = State.Stack.back().StartOfArraySubscripts;
else