forked from OSchip/llvm-project
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()); llvm-svn: 176952
This commit is contained in:
parent
62b85b9610
commit
8f6ae19129
|
@ -894,7 +894,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
||||||
|
|
||||||
if (Right.isOneOf(tok::arrow, tok::period)) {
|
if (Right.isOneOf(tok::arrow, tok::period)) {
|
||||||
if (Line.Type == LT_BuilderTypeCall)
|
if (Line.Type == LT_BuilderTypeCall)
|
||||||
return 5;
|
return 14;
|
||||||
if (Left.isOneOf(tok::r_paren, tok::r_square) && Left.MatchingParen &&
|
if (Left.isOneOf(tok::r_paren, tok::r_square) && Left.MatchingParen &&
|
||||||
Left.MatchingParen->ParameterCount > 0)
|
Left.MatchingParen->ParameterCount > 0)
|
||||||
return 20; // Should be smaller than breaking at a nested comma.
|
return 20; // Should be smaller than breaking at a nested comma.
|
||||||
|
|
|
@ -1664,6 +1664,10 @@ TEST_F(FormatTest, WrapsAtFunctionCallsIfNecessary) {
|
||||||
verifyFormat(
|
verifyFormat(
|
||||||
"aaaaaaaaaaaaaaaaaaaaaaaaa(\n"
|
"aaaaaaaaaaaaaaaaaaaaaaaaa(\n"
|
||||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa().aaaaaaaaaaaaaaaaa());");
|
" 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();
|
FormatStyle NoBinPacking = getLLVMStyle();
|
||||||
NoBinPacking.BinPackParameters = false;
|
NoBinPacking.BinPackParameters = false;
|
||||||
|
|
Loading…
Reference in New Issue