clang-format: Revamp nested block formatting.
This fixed llvm.org/PR21804 and hopefully a few other strange cases.
Before:
if (blah_blah(whatever, whatever, [] {
doo_dah();
doo_dah();
})) {
}
}
After:
if (blah_blah(whatever, whatever, [] {
doo_dah();
doo_dah();
})) {
}
}
llvm-svn: 224112
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index fdcfe79..2b4553c 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -5912,8 +5912,7 @@
" BracedList{ // comment 1 (Forcing interesting break)\n"
" param1, param2,\n"
" // comment 2\n"
- " param3, param4\n"
- " });",
+ " param3, param4 });",
ExtraSpaces);
verifyFormat(
"std::this_thread::sleep_for(\n"
@@ -9421,6 +9420,12 @@
verifyFormat("void f() {\n"
" MACRO((const AA &a) { return 1; });\n"
"}");
+
+ verifyFormat("if (blah_blah(whatever, whatever, [] {\n"
+ " doo_dah();\n"
+ " doo_dah();\n"
+ " })) {\n"
+ "}");
}
TEST_F(FormatTest, FormatsBlocks) {