From 143a2f208bbd404d06f63584d757c2d9b4523f41 Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Fri, 6 Dec 2013 15:19:50 +0000 Subject: [PATCH] clang-format: Change line break decisions for array subscripts. Before: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [aaaaaaaaaaaa]; After: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa]; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196582 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Format/TokenAnnotator.cpp | 2 +- unittests/Format/FormatTest.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 804db62833..d4880a472d 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -1134,7 +1134,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, if (Left.is(tok::comma)) return 1; if (Right.is(tok::l_square)) - return 150; + return 250; if (Right.Type == TT_StartOfName || Right.is(tok::kw_operator)) { if (Line.First->is(tok::kw_for) && Right.PartOfMultiVariableDeclStmt) diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index 575644efc5..2860bbbedd 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -4558,6 +4558,9 @@ TEST_F(FormatTest, FormatsArrays) { "llvm::outs() << \"aaaaaaaaaaaa: \"\n" " << (*aaaaaaaiaaaaaaa)[aaaaaaaaaaaaaaaaaaaaaaaaa]\n" " [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa];"); + + verifyGoogleFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" + " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa];"); } TEST_F(FormatTest, LineStartsWithSpecialCharacter) { -- 2.40.0