From 731dde91db80686eec141cc3ee0ef9594e1a85c6 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 15 May 2015 09:41:59 +0000 Subject: clang-format: Don't use column layout in lists that have separating comments. At some point, we might to want to a layout with a different number of columns instead, but at the moment, this causes more confusion than it's worth. llvm-svn: 237427 --- clang/unittests/Format/FormatTest.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'clang/unittests/Format/FormatTest.cpp') diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 9661919f517..ecc1a7e1342 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -6313,11 +6313,9 @@ TEST_F(FormatTest, FormatsBracedListsInColumnLayout) { " 1, 22, 333, 4444, 55555, 666666, 7777777,\n" " 1, 22, 333, 4444, 55555, 666666, 7777777,\n" " 1, 22, 333, 4444, 55555, 666666, 7777777};"); - verifyFormat("vector x = {1, 22, 333, 4444, 55555, 666666, 7777777,\n" - " // line comment\n" + verifyFormat("vector x = {1, 22, 333, 4444, 55555, 666666, 7777777, //\n" " 1, 22, 333, 4444, 55555, 666666, 7777777,\n" - " 1, 22, 333, 4444, 55555,\n" - " // line comment\n" + " 1, 22, 333, 4444, 55555, //\n" " 1, 22, 333, 4444, 55555, 666666, 7777777,\n" " 1, 22, 333, 4444, 55555, 666666, 7777777};"); verifyFormat( @@ -6331,6 +6329,14 @@ TEST_F(FormatTest, FormatsBracedListsInColumnLayout) { verifyFormat("static const uint16_t CallerSavedRegs64Bittttt[] = {\n" " X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,\n" " X86::R8, X86::R9, X86::R10, X86::R11, 0};"); + verifyFormat("static const uint16_t CallerSavedRegs64Bittttt[] = {\n" + " X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,\n" + " // Separating comment.\n" + " X86::R8, X86::R9, X86::R10, X86::R11, 0};"); + verifyFormat("static const uint16_t CallerSavedRegs64Bittttt[] = {\n" + " // Leading comment\n" + " X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,\n" + " X86::R8, X86::R9, X86::R10, X86::R11, 0};"); verifyFormat("vector x = {1, 1, 1, 1,\n" " 1, 1, 1, 1};", getLLVMStyleWithColumns(39)); -- cgit v1.2.3