clang-format: Fix corner case in "if it saves columns"-calculation.

Before:
  aaaa
      .aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
	  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
  aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
	  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
      .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 256841
This commit is contained in:
Daniel Jasper 2016-01-05 16:10:39 +00:00
parent 5cbae95916
commit 411af72e8c
2 changed files with 5 additions and 2 deletions

View File

@ -177,7 +177,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) {
return true;
unsigned NewLineColumn = getNewLineColumn(State);
if (State.Column < NewLineColumn)
if (State.Column <= NewLineColumn)
return false;
if (Current.isMemberAccess() &&

View File

@ -4251,6 +4251,9 @@ TEST_F(FormatTest, FormatsBuilderPattern) {
" .aaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa)\n"
" .aaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa);",
getLLVMStyleWithColumns(59));
verifyFormat("aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(\n"
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
" .aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
}
TEST_F(FormatTest, BreaksAccordingToOperatorPrecedence) {
@ -8305,7 +8308,7 @@ TEST_F(FormatTest, ConfigurableUseOfTab) {
"\taaaaaaaaaaaaaaaaaaaaaaaaaaaa();\n"
"};",
Tab);
verifyFormat("enum A {\n"
verifyFormat("enum AA {\n"
"\ta1, // Force multiple lines\n"
"\ta2,\n"
"\ta3\n"