[PATCH] D79465: Fix line lengths w/ comments in align
Jake Merdich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 6 08:02:58 PDT 2020
JakeMerdichAMD added a comment.
Mind looking again? They did add one later on I think. It helped a lot since the exact settings and whitespace to trigger this are really finicky (though reproducible). You're right that it won't reproduce without it.
Here's a run log of the failing test I added, with the functional change commented out so it actually fails. Does this reproduce on your machine?
jmerdich at JM-LDEV1:/opt/ws/llvm-project/build$ git log --oneline -n2
9b146e8534b (HEAD -> pr43845) Fix line lengths w/ comments in align
d05f8a38c54 (origin/master, origin/HEAD) [ARM] VMOVrh of VMOVhr
jmerdich at JM-LDEV1:/opt/ws/llvm-project/build$ git diff
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 5f6bde9f2d4..b2c6e6a16a2 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -412,7 +412,7 @@ static unsigned AlignTokens(const FormatStyle &Style, F &&Matches,
int LineLengthAfter = -Changes[i].Spaces;
for (unsigned j = i; j != e && Changes[j].NewlinesBefore == 0; ++j) {
LineLengthAfter += Changes[j].Spaces;
- if (!Changes[j].IsInsideToken)
+ //if (!Changes[j].IsInsideToken)
LineLengthAfter += Changes[j].TokenLength;
}
unsigned ChangeMaxColumn = Style.ColumnLimit - LineLengthAfter;
jmerdich at JM-LDEV1:/opt/ws/llvm-project/build$ ninja -j12 FormatTests
ninja: no work to do.
jmerdich at JM-LDEV1:/opt/ws/llvm-project/build$ tools/clang/unittests/Format/FormatTests --gtest_filter="*AlignConsecutiveAss*"
Note: Google Test filter = *AlignConsecutiveAss*
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from FormatTest
[ RUN ] FormatTest.AlignConsecutiveAssignments
/opt/ws/llvm-project/clang/unittests/Format/FormatTest.cpp:11576: Failure
Expected: "int x = 0;\n" "int yy = 1; /// specificlennospace\n" "int zzz = 2;\n"
Which is: "int x = 0;\nint yy = 1; /// specificlennospace\nint zzz = 2;\n"
To be equal to: format("int x = 0;\n" "int yy = 1; ///specificlennospace\n" "int zzz = 2;\n", Alignment)
Which is: "int x = 0;\nint yy = 1; /// specificlennospace\nint zzz = 2;\n"
With diff:
@@ -1,3 +1,3 @@
-int x = 0;
-int yy = 1; /// specificlennospace
+int x = 0;
+int yy = 1; /// specificlennospace
int zzz = 2;\n
[ FAILED ] FormatTest.AlignConsecutiveAssignments (126 ms)
[----------] 1 test from FormatTest (126 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (127 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] FormatTest.AlignConsecutiveAssignments
1 FAILED TEST
jmerdich at JM-LDEV1:/opt/ws/llvm-project/build$
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79465/new/
https://reviews.llvm.org/D79465
More information about the cfe-commits
mailing list