clang-format: Slightly adapt line break in edge case.

Before:
  SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)]
      .insert(ccccccccccccccccccccccc);

After:
  SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)].insert(
      ccccccccccccccccccccccc);

This seems to be about 3:1 more common in Google and Chromium style and I found
only a handful of instances inside the LLVM codebase.

llvm-svn: 198924
This commit is contained in:
Daniel Jasper 2014-01-10 08:40:17 +00:00
parent 73cb84c271
commit 4d7a97adfc
2 changed files with 3 additions and 3 deletions

View File

@ -1203,7 +1203,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
return 2;
if (Right.isMemberAccess()) {
if (Left.isOneOf(tok::r_paren, tok::r_square) && Left.MatchingParen &&
if (Left.is(tok::r_paren) && Left.MatchingParen &&
Left.MatchingParen->ParameterCount > 0)
return 20; // Should be smaller than breaking at a nested comma.
return 150;

View File

@ -3910,8 +3910,8 @@ TEST_F(FormatTest, WrapsAtFunctionCallsIfNecessary) {
verifyFormat("EXPECT_CALL(SomeObject, SomeFunction(Parameter))\n"
" .WillRepeatedly(Return(SomeValue));");
verifyFormat("SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)]\n"
" .insert(ccccccccccccccccccccccc);");
verifyFormat("SomeMap[std::pair(aaaaaaaaaaaa, bbbbbbbbbbbbbbb)].insert(\n"
" ccccccccccccccccccccccc);");
verifyFormat("aaaaa(aaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa).aaaaa(aaaaa),\n"
" aaaaaaaaaaaaaaaaaaaaa);");