forked from OSchip/llvm-project
clang-format: Slightly row back on r256343 by increasing penalty for
breaking between array subscripts. Before: if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa] [aaaaaaaaaaaaa]) After: if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa][aaaaaaaaaaaaa]) llvm-svn: 256640
This commit is contained in:
parent
113438cd5c
commit
e1afb9b8ee
|
@ -1715,8 +1715,10 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
|||
Right.Next->is(TT_DictLiteral)))
|
||||
return 1;
|
||||
if (Right.is(tok::l_square)) {
|
||||
if (Style.Language == FormatStyle::LK_Proto || Left.is(tok::r_square))
|
||||
if (Style.Language == FormatStyle::LK_Proto)
|
||||
return 1;
|
||||
if (Left.is(tok::r_square))
|
||||
return 25;
|
||||
// Slightly prefer formatting local lambda definitions like functions.
|
||||
if (Right.is(TT_LambdaLSquare) && Left.is(tok::equal))
|
||||
return 50;
|
||||
|
|
|
@ -6047,6 +6047,8 @@ TEST_F(FormatTest, FormatsArrays) {
|
|||
" [bbbbbbbbbbbbbbbbbbbbbbbbb] = c;");
|
||||
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaa[aaaaaaaaaaa(aaaaaaaaaaaa)]\n"
|
||||
" [bbbbbbbbbbb(bbbbbbbbbbbb)] = c;");
|
||||
verifyFormat("if (aaaaaaaaaaaaaaaaaaaaaaaa &&\n"
|
||||
" aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa][aaaaaaaaaaaaa]) {\n}");
|
||||
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||
" [bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb] = ccccccccccc;");
|
||||
verifyFormat("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||
|
|
Loading…
Reference in New Issue