[PATCH] D40310: Restructure how we break tokens.

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 27 02:55:20 PST 2017


klimek added inline comments.


================
Comment at: lib/Format/ContinuationIndenter.cpp:1518
+  unsigned RemainingTokenColumns = 0;
+  // The column number we're currently at.
+  unsigned ContentStartColumn = 0;
----------------
krasimir wrote:
> Could you please spell out the invariants that we maintain about `TailOffset`, `RemainingTokenColumns` and `ContentStartColumn` (at least) at the beginning of every main loop iteration below? That would surely make it easier to review.
I'm not sure what you mean - I would literally write what I already wrote in the comment. Can you formulate questions so I can make sure I answer them?


================
Comment at: lib/Format/ContinuationIndenter.cpp:1533
+      // ContentStartColumn is either
+      // - at the start of the line, directly after a break
+      // - the end of the last line +1, when continuing a reflow over multiple
----------------
krasimir wrote:
> If the previous iteration requested that we try to reflow, how can `ContentStartColumn` be at the start of the (current) line?
After a line break (that was already in the original text), ContentStartColumn is set to where we want the first character of the broken line to start.


https://reviews.llvm.org/D40310





More information about the cfe-commits mailing list