forked from OSchip/llvm-project
clang-format: Make it very slighly more expensive to wrap between "= {".
This prevents unwanted fallout from r296664. Specifically in proto formatting, this changed: optional Aaaaaaaa aaaaaaaa = 12 [ (aaa) = aaaa, (bbbbbbbbbbbbbbbbbbbbbbbbbb) = { aaaaaaaaaaaaaaaaa: true, aaaaaaaaaaaaaaaa: true } ]; Into: optional Aaaaaaaa aaaaaaaa = 12 [ (aaa) = aaaa, (bbbbbbbbbbbbbbbbbbbbbbbbbb) = {aaaaaaaaaaaaaaaaa: true, aaaaaaaaaaaaaaaa: true} ]; Which is considered less readable. Generally, it seems preferable to format such dict literals as blocks rather than contract them to one line. llvm-svn: 297696
This commit is contained in:
parent
54e22f33d9
commit
c79e4d2d25
|
@ -1976,7 +1976,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
||||||
if (Right.is(TT_LambdaArrow))
|
if (Right.is(TT_LambdaArrow))
|
||||||
return 110;
|
return 110;
|
||||||
if (Left.is(tok::equal) && Right.is(tok::l_brace))
|
if (Left.is(tok::equal) && Right.is(tok::l_brace))
|
||||||
return 150;
|
return 160;
|
||||||
if (Left.is(TT_CastRParen))
|
if (Left.is(TT_CastRParen))
|
||||||
return 100;
|
return 100;
|
||||||
if (Left.is(tok::coloncolon) ||
|
if (Left.is(tok::coloncolon) ||
|
||||||
|
|
|
@ -138,6 +138,13 @@ TEST_F(FormatTestProto, MessageFieldAttributes) {
|
||||||
verifyFormat("optional string test = 1 [default =\n"
|
verifyFormat("optional string test = 1 [default =\n"
|
||||||
" \"test\"\n"
|
" \"test\"\n"
|
||||||
" \"test\"];");
|
" \"test\"];");
|
||||||
|
verifyFormat("optional Aaaaaaaa aaaaaaaa = 12 [\n"
|
||||||
|
" (aaa) = aaaa,\n"
|
||||||
|
" (bbbbbbbbbbbbbbbbbbbbbbbbbb) = {\n"
|
||||||
|
" aaaaaaaaaaaaaaaaa: true,\n"
|
||||||
|
" aaaaaaaaaaaaaaaa: true\n"
|
||||||
|
" }\n"
|
||||||
|
"];");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTestProto, DoesntWrapFileOptions) {
|
TEST_F(FormatTestProto, DoesntWrapFileOptions) {
|
||||||
|
|
Loading…
Reference in New Issue