clang-format: Treat braced lists like other complex parameters.
Specifically, wrap before them if they are multi-line so that we don't
create long hanging indents. This prevents having a lot of code
indented a lot in some cases.
Before:
someFunction(Param, {List1, List2,
List3});
After:
someFunction(Param,
{List1, List2,
List3});
llvm-svn: 291801
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 629e858..640d9bd 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -6816,6 +6816,12 @@
" aaaaaa.aaaaaaa,\n"
" aaaaaa.aaaaaaa,\n"
"};");
+
+ // Don't create hanging lists.
+ verifyFormat("someFunction(Param,\n"
+ " {List1, List2,\n"
+ " List3});",
+ getLLVMStyleWithColumns(35));
}
TEST_F(FormatTest, PullTrivialFunctionDefinitionsIntoSingleLine) {