summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
-rw-r--r--clang/unittests/Format/FormatTest.cpp4
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 3793fe056ed..0760f35bbbc 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1315,7 +1315,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
if (Right.is(tok::l_square)) {
if (Style.Language == FormatStyle::LK_Proto)
return 1;
- if (Right.Type != TT_ObjCMethodExpr)
+ if (Right.Type != TT_ObjCMethodExpr && Right.Type != TT_LambdaLSquare)
return 500;
}
if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator)) {
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 968e13b3feb..11a42a51faf 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8721,6 +8721,8 @@ TEST_F(FormatTest, FormatsLambdas) {
verifyFormat("void f() {\n"
" SomeFunction([](decltype(x), A *a) {});\n"
"}");
+ verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
+ " [](const aaaaaaaaaa &a) { return a; });");
// Lambdas with return types.
verifyFormat("int c = []() -> int { return 2; }();\n");
@@ -8728,7 +8730,7 @@ TEST_F(FormatTest, FormatsLambdas) {
verifyFormat("Foo([]() -> std::vector<int> { return {2}; }());");
verifyFormat("auto aaaaaaaa = [](int i, // break for some reason\n"
" int j) -> int {\n"
- " return fffffffffffffffffffffffffffffffffffffff(i * j);\n"
+ " return ffffffffffffffffffffffffffffffffffffffffffff(i * j);\n"
"};");
// Multiple lambdas in the same parentheses change indentation rules.
OpenPOWER on IntegriCloud