Fix formatting issue with builder-type calls.

Before:
->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() - aaaaaaaaa()->aaaaaa()
                                                             ->aaaaa());

After:
a->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() -
                         aaaaaaaaa()->aaaaaa()->aaaaa());

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176952 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Jasper 2013-03-13 15:37:48 +00:00
Родитель e74de28ec3
Коммит 8d0d19aa33
2 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -894,7 +894,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
if (Right.isOneOf(tok::arrow, tok::period)) {
if (Line.Type == LT_BuilderTypeCall)
return 5;
return 14;
if (Left.isOneOf(tok::r_paren, tok::r_square) && Left.MatchingParen &&
Left.MatchingParen->ParameterCount > 0)
return 20; // Should be smaller than breaking at a nested comma.

Просмотреть файл

@ -1664,6 +1664,10 @@ TEST_F(FormatTest, WrapsAtFunctionCallsIfNecessary) {
verifyFormat(
"aaaaaaaaaaaaaaaaaaaaaaaaa(\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa().aaaaaaaaaaaaaaaaa());");
verifyFormat("a->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() *\n"
" aaaaaaaaa()->aaaaaa()->aaaaa());");
verifyFormat("a->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() ||\n"
" aaaaaaaaa()->aaaaaa()->aaaaa());");
FormatStyle NoBinPacking = getLLVMStyle();
NoBinPacking.BinPackParameters = false;