[PATCH] Fixes incorrect indentation of line comments after break and re-alignment.

Manuel Klimek klimek at google.com
Mon Jun 17 05:58:12 PDT 2013


On Mon, Jun 17, 2013 at 2:57 PM, Alexander Kornienko <alexfh at google.com>wrote:

>
>
> ================
> Comment at: lib/Format/WhitespaceManager.cpp:71
> @@ -70,2 +70,3 @@
>        // correctly store a tok::TokenKind instead of rolling our own enum.
> -      tok::unknown, InPPDirective && !Tok.IsFirst));
> +      Tok.Type == TT_LineComment && Newlines > 0 ? tok::comment :
> tok::unknown,
> +      InPPDirective && !Tok.IsFirst));
> ----------------
> Manuel Klimek wrote:
> > Alexander Kornienko wrote:
> > > Manuel Klimek wrote:
> > > > Why does Newlines > 0 make a difference here?
> > > This should be tok::comment only if we create the new comment.
> Currently in case Newlines == 0 we're just inserting one space, no new
> comment is created.
> > Makes sense, please add a comment :)
> How about this?
>       // If we don't add a newline this change doesn't start start a
> comment.
>

s/start//


>       // When we align line comments, we don't need to treat this change
> as one.
>

Thus, when ...


>       // FIXME: We still need to take this change in account to properly
>       // calculate the new length of the comment when aligning comments.
>

and to calculate the changes for which to do the alignment.


>
>
> http://llvm-reviews.chandlerc.com/D980
>
> BRANCH
>   svn
>
> ARCANIST PROJECT
>   clang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130617/b7cde1e1/attachment.html>


More information about the cfe-commits mailing list