sstwcw created this revision. sstwcw added a reviewer: clang-format. sstwcw added a project: clang-format. sstwcw requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D119625 Files: clang/lib/Format/WhitespaceManager.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -16847,9 +16847,11 @@ "double b();", Alignment); unsigned OldColumnLimit = Alignment.ColumnLimit; - // We need to set ColumnLimit to zero, in order to stress nested alignments, - // otherwise the function parameters will be re-flowed onto a single line. - Alignment.ColumnLimit = 0; + // We need to set ColumnLimit to a small number, in order to stress + // nested alignments, otherwise the function parameters will be + // re-flowed onto a single line. It also needs to be wide enough so + // that things still get aligned. + Alignment.ColumnLimit = 20; EXPECT_EQ("int a(int x,\n" " float y);\n" "double b(int x,\n" Index: clang/lib/Format/WhitespaceManager.cpp =================================================================== --- clang/lib/Format/WhitespaceManager.cpp +++ clang/lib/Format/WhitespaceManager.cpp @@ -575,7 +575,7 @@ if (!Changes[j].IsInsideToken) LineLengthAfter += Changes[j].TokenLength; } - unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter; + int ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter; // If we are restricted by the maximum column width, end the sequence. if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn ||
Index: clang/unittests/Format/FormatTest.cpp =================================================================== --- clang/unittests/Format/FormatTest.cpp +++ clang/unittests/Format/FormatTest.cpp @@ -16847,9 +16847,11 @@ "double b();", Alignment); unsigned OldColumnLimit = Alignment.ColumnLimit; - // We need to set ColumnLimit to zero, in order to stress nested alignments, - // otherwise the function parameters will be re-flowed onto a single line. - Alignment.ColumnLimit = 0; + // We need to set ColumnLimit to a small number, in order to stress + // nested alignments, otherwise the function parameters will be + // re-flowed onto a single line. It also needs to be wide enough so + // that things still get aligned. + Alignment.ColumnLimit = 20; EXPECT_EQ("int a(int x,\n" " float y);\n" "double b(int x,\n" Index: clang/lib/Format/WhitespaceManager.cpp =================================================================== --- clang/lib/Format/WhitespaceManager.cpp +++ clang/lib/Format/WhitespaceManager.cpp @@ -575,7 +575,7 @@ if (!Changes[j].IsInsideToken) LineLengthAfter += Changes[j].TokenLength; } - unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter; + int ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter; // If we are restricted by the maximum column width, end the sequence. if (ChangeMinColumn > MaxColumn || ChangeMaxColumn < MinColumn ||
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits