summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-10-24 14:14:49 +0000
committerDaniel Jasper <djasper@google.com>2013-10-24 14:14:49 +0000
commit7c72d9fef2555e45b5095977a825a4e520c4f8b2 (patch)
tree507d295fb7a083c96ea431232715a1629db2db8c /clang/unittests/Format/FormatTest.cpp
parente38e57206fd4da7ac721608a229bf802d6fe23b9 (diff)
downloadbcm5719-llvm-7c72d9fef2555e45b5095977a825a4e520c4f8b2.tar.gz
bcm5719-llvm-7c72d9fef2555e45b5095977a825a4e520c4f8b2.zip
clang-format: Be more conservative about column layout formatting.
Specifically, if a braced list has at least one nested braced list, format it either all on one line or in one column (i.e. one item per line). This seems in general to be an improvement as the structure of nested braced lists can make a tightly packed outer braced list hard to read. llvm-svn: 193345
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index f6e42ca211d..9b24f040d16 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1864,14 +1864,14 @@ TEST_F(FormatTest, NestedStaticInitializers) {
" 333333333333333333333333333333}},\n"
" {{1, 2, 3}}, {{1, 2, 3}}};");
- // FIXME: We might at some point want to handle this similar to parameter
- // lists, where we have an option to put each on a single line.
verifyFormat(
"struct {\n"
" unsigned bit;\n"
" const char *const name;\n"
- "} kBitsToOs[] = { { kOsMac, \"Mac\" }, { kOsWin, \"Windows\" },\n"
- " { kOsLinux, \"Linux\" }, { kOsCrOS, \"Chrome OS\" } };");
+ "} kBitsToOs[] = { { kOsMac, \"Mac\" },\n"
+ " { kOsWin, \"Windows\" },\n"
+ " { kOsLinux, \"Linux\" },\n"
+ " { kOsCrOS, \"Chrome OS\" } };");
}
TEST_F(FormatTest, FormatsSmallMacroDefinitionsInSingleLine) {
@@ -4539,8 +4539,10 @@ TEST_F(FormatTest, FormatsBracedListsinColumnLayout) {
" 1, 1, 1, 1,\n"
" /**/ /**/ };",
getLLVMStyleWithColumns(39));
- verifyFormat("return { { aaaaaaaaaaaaaaaaaaaaa }, { aaaaaaaaaaaaaaaaaaa },\n"
- " { aaaaaaaaaaaaaaaaaaaaa }, { aaaaaaaaaaaaaaaaa } };",
+ verifyFormat("return { { aaaaaaaaaaaaaaaaaaaaa },\n"
+ " { aaaaaaaaaaaaaaaaaaa },\n"
+ " { aaaaaaaaaaaaaaaaaaaaa },\n"
+ " { aaaaaaaaaaaaaaaaa } };",
getLLVMStyleWithColumns(60));
}
OpenPOWER on IntegriCloud