[PATCH] D29626: [clang-format] Break before a sequence of line comments aligned with the next line.

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 8 01:38:15 PST 2017


klimek added inline comments.


================
Comment at: lib/Format/UnwrappedLineParser.h:121-123
+  // Comments specifies the sequence of comment tokens to analyze. They get
+  // either pushed to the current line or added to the comments before the next
+  // token.
----------------
krasimir wrote:
> klimek wrote:
> > krasimir wrote:
> > > klimek wrote:
> > > > Given this, I'd perhaps call this addSection or addCommentSection or something similar? analyze sounds like it doesn't change the state of the class...
> > > Maybe distributeCommentsAccordingToAlignment?
> > I don't think "AccordingToAlignment" needs to be in the name - it's fine that that's in the comment, and it's kind of a detail of what this does.
> > 
> > The important thing at the call site is that this adds comments to the current unwrapped line, right?
> That's just half of it: it may add comments to the current line, and it may add comments to the sequence of tokens preceding the next token with conceptually belong to the next token and will be put in a new line if the next token has to be put on a new line.
> After a while, there is "flushComments" which takes care of the mentioned comments before next token.
Sure, but the important part seems to be that it decides which comment tokens belong into the current line?


https://reviews.llvm.org/D29626





More information about the cfe-commits mailing list