Typz added a comment. 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) ================ Comment at: lib/Format/BreakableToken.cpp:293 Split ReflowSplit = - FullWidth <= ColumnLimit - ? Split(TrimmedText.size(), Text.size() - TrimmedText.size()) - : getCommentSplit(Text, ReflowStartColumn, ColumnLimit, - Style.TabWidth, Encoding); - +// FullWidth <= ColumnLimit + //? ---------------- commented-out code to be removed? ================ Comment at: lib/Format/BreakableToken.cpp:300 + + return ReflowSplit; // We need to be extra careful here, because while it's OK to keep a long line ---------------- unconditional return --> remove the end of the function ================ Comment at: lib/Format/BreakableToken.cpp:572 + return Split(0, 0); + /* StringRef TrimmedContent = Content[LineIndex].ltrim(Blanks); ---------------- remove commented-out code ================ Comment at: lib/Format/BreakableToken.cpp:603 + // FIXME: pull together with getLineLegnthAfterSplit (same as for + // BreakableLineCommentSeciotn. + unsigned ContentStartColumn = 0; ---------------- BreakableLineCommentSection https://reviews.llvm.org/D40068 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits