r196582 - clang-format: Change line break decisions for array subscripts.
Daniel Jasper
djasper at google.com
Fri Dec 6 07:19:51 PST 2013
Author: djasper
Date: Fri Dec 6 09:19:50 2013
New Revision: 196582
URL: http://llvm.org/viewvc/llvm-project?rev=196582&view=rev
Log:
clang-format: Change line break decisions for array subscripts.
Before:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
[aaaaaaaaaaaa];
After:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa];
Modified:
cfe/trunk/lib/Format/TokenAnnotator.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/TokenAnnotator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/TokenAnnotator.cpp?rev=196582&r1=196581&r2=196582&view=diff
==============================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp (original)
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp Fri Dec 6 09:19:50 2013
@@ -1134,7 +1134,7 @@ unsigned TokenAnnotator::splitPenalty(co
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)
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=196582&r1=196581&r2=196582&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Fri Dec 6 09:19:50 2013
@@ -4558,6 +4558,9 @@ TEST_F(FormatTest, FormatsArrays) {
"llvm::outs() << \"aaaaaaaaaaaa: \"\n"
" << (*aaaaaaaiaaaaaaa)[aaaaaaaaaaaaaaaaaaaaaaaaa]\n"
" [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa];");
+
+ verifyGoogleFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<int>\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaa];");
}
TEST_F(FormatTest, LineStartsWithSpecialCharacter) {
More information about the cfe-commits
mailing list