r256841 - clang-format: Fix corner case in "if it saves columns"-calculation.
Daniel Jasper via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 5 08:10:40 PST 2016
Author: djasper
Date: Tue Jan 5 10:10:39 2016
New Revision: 256841
URL: http://llvm.org/viewvc/llvm-project?rev=256841&view=rev
Log:
clang-format: Fix corner case in "if it saves columns"-calculation.
Before:
aaaa
.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
After:
aaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
.aaaaaa(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
Modified:
cfe/trunk/lib/Format/ContinuationIndenter.cpp
cfe/trunk/unittests/Format/FormatTest.cpp
Modified: cfe/trunk/lib/Format/ContinuationIndenter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/ContinuationIndenter.cpp?rev=256841&r1=256840&r2=256841&view=diff
==============================================================================
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Tue Jan 5 10:10:39 2016
@@ -177,7 +177,7 @@ bool ContinuationIndenter::mustBreak(con
return true;
unsigned NewLineColumn = getNewLineColumn(State);
- if (State.Column < NewLineColumn)
+ if (State.Column <= NewLineColumn)
return false;
if (Current.isMemberAccess() &&
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=256841&r1=256840&r2=256841&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Tue Jan 5 10:10:39 2016
@@ -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"
More information about the cfe-commits
mailing list