clang-format: Improve format of calls with several lambdas.
Before:
SomeFunction([]() {
int i = 42;
return i;
},
[]() {
int j = 43;
return j;
});
After:
SomeFunction([]() {
int i = 42;
return i;
},
[]() {
int j = 43;
return j;
});
llvm-svn: 205848
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index b9310ab..b932b27 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8171,6 +8171,16 @@
" return fffffffffffffffffffffffffffffffffffffff(i * j);\n"
"};");
+ // Multiple lambdas in the same parentheses change indentation rules.
+ verifyFormat("SomeFunction([]() {\n"
+ " int i = 42;\n"
+ " return i;\n"
+ " },\n"
+ " []() {\n"
+ " int j = 43;\n"
+ " return j;\n"
+ " });");
+
// Not lambdas.
verifyFormat("constexpr char hello[]{\"hello\"};");
verifyFormat("double &operator[](int i) { return 0; }\n"