Author: djasper
Date: Thu Jan 14 07:36:46 2016
New Revision: 257763
URL: http://llvm.org/viewvc/llvm-project?rev=257763=rev
Log:
clang-format: Fix incorrectly enforced linebreak with ColumnLimit 0.
Before:
[]
.();
After:
[].();
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=257763=257762=257763=diff
==
--- cfe/trunk/lib/Format/ContinuationIndenter.cpp (original)
+++ cfe/trunk/lib/Format/ContinuationIndenter.cpp Thu Jan 14 07:36:46 2016
@@ -182,7 +182,7 @@ bool ContinuationIndenter::mustBreak(con
return true;
unsigned NewLineColumn = getNewLineColumn(State);
- if (Current.isMemberAccess() &&
+ if (Current.isMemberAccess() && Style.ColumnLimit != 0 &&
State.Column + getLengthToNextOperator(Current) > Style.ColumnLimit &&
(State.Column > NewLineColumn ||
Current.NestingLevel < State.StartOfLineLevel))
Modified: cfe/trunk/unittests/Format/FormatTest.cpp
URL:
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTest.cpp?rev=257763=257762=257763=diff
==
--- cfe/trunk/unittests/Format/FormatTest.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTest.cpp Thu Jan 14 07:36:46 2016
@@ -6135,6 +6135,9 @@ TEST_F(FormatTest, FormatsArrays) {
" .aa();");
verifyNoCrash("a[,Y?)]", getLLVMStyleWithColumns(10));
+
+ FormatStyle NoColumnLimit = getLLVMStyleWithColumns(0);
+ verifyFormat("a[bb].cc()", NoColumnLimit);
}
TEST_F(FormatTest, LineStartsWithSpecialCharacter) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits