This is a counter-proposal to D33589.
Diff Detail
- Build Status
Buildable 12269 Build 12269: arc lint + arc unit
Event Timeline
lib/Format/ContinuationIndenter.cpp | ||
---|---|---|
1517 | I'd rather DEBUG({ if (ReflowInProgress) llvm::dbgs() << " Reflowing.\n"; }); | |
unittests/Format/FormatTest.cpp | ||
8007 | Why did the string got on a newline here? | |
unittests/Format/FormatTestComments.cpp | ||
2452 | Please also leave the old test case, which is about the */ just going over the column limit if not put on a newline. | |
2461 | Why change 15 to 16? The same for the subsequent cases. | |
2493 | Please also leave the old test case, which is about the */ just going over the column limit if not put on a newline. | |
2495–2507 | Please also leave the old test case, which is about the */ just going over the column limit if not put on a newline. |
Address review comments.
unittests/Format/FormatTest.cpp | ||
---|---|---|
8007 | Because then we break inside the string less often? That seems clearly better than before? | |
unittests/Format/FormatTestComments.cpp | ||
2461 | Because we're breaking before the comment now (see above), which according to the doc I wrote you agree is better, but changing all the tests seemed to then test something completely different. |
Generally, this indeed improves the situation (though I cannot say much about the code itself, it is still too subtle for my shallow knowledge of clang-format).
But it seems to give some strange looking result with long comments: it seems like the decision is made at each line (e.g. is it better to wrap this line or overflow a bit), so we can get a comment where each line overflows by a few characters, even if the total is worse... For exemple, say we have a 100 lines of comment, with 9 characters overflow on each line, and an excess character penalty of 30 : with this patch nothing will be re-wrapped (9*30 = 270 is less the the 300 penalty for wrapping); but the total penatly would be 900....
(btw, it seems this got merged, but the ticket does not reflect it)
lib/Format/BreakableToken.cpp | ||
---|---|---|
289 | commented-out code to be removed? | |
296 | unconditional return --> remove the end of the function | |
560 | remove commented-out code | |
595 | BreakableLineCommentSection |
Ugh, sorry, I think an arc patch I did without --create on a branch that was branched after the original patch was sent out broke phab :( :( This is not actually the state the patch was in when submitted, or the state it was LG'ed in (see https://reviews.llvm.org/rL318515 for the smaller patch)
Self-accepting and closing, as the underlying change has landed, and this diff is incorrect now.
I also have an idea to solve the problem Typz has brought up.
commented-out code to be removed?