зеркало из https://github.com/microsoft/clang-1.git
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:
Родитель
e74de28ec3
Коммит
8d0d19aa33
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче