klimek added inline comments.

================
Comment at: lib/Format/BreakableToken.h:42-48
+/// There is a pair of operations that are used to compress a long whitespace
+/// range with a single space if that will bring the line lenght under the
+/// column limit:
+/// - getLineLengthAfterCompress, for calculating the size in columns of the
+///   line after a whitespace range has been compressed, and
+/// - compressWhitespace, for executing the whitespace compression using a
+///   whitespace manager.
----------------
krasimir wrote:
> klimek wrote:
> > I assume the reason to not fold this into the next getSplitBefore is that 
> > sometimes we need to do the trimming even if we're the last line? Would it 
> > otherwise make sense?
> The reason why we can't fold is that the compressing and the reflow of the 
> next might be independent and operate on totally different whitespace ranges.
> Consider the following comments with line length 20:
> ```
> // Column limit 20 |
> // long           long
> // long
> ```
> Then after compressWhitespace(line 2) we get:
> ```
> // Column limit 20 |
> // long long
> // long
> ```
> And now replaceWhitespaceBefore(line 3) will reflow:
> ```
> // Column limit 20 |
> // long long long
> ```
> 
> Will add a note about this.
> 
Ah, wow, nice!


https://reviews.llvm.org/D28764



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to