[PATCH] D33589: clang-format: consider not splitting tokens in optimization

Manuel Klimek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 23 02:30:54 PST 2017


klimek added a comment.

In https://reviews.llvm.org/D33589#931802, @Typz wrote:

> Btw, another issue I am having is that reflowing does not respect the alignment. For exemple:
>
>   enum {
>      Foo,    ///< This is a very long comment
>      Bar,    ///< This is shorter  
>      BarBar, ///< This is shorter
>   } Stuff;
>   
>
> will be reflown to :
>
>   enum {
>      Foo, ///< This is a very long
>           ///< comment
>      Bar, ///< This is shorter  
>      BarBar, ///< This is shorter
>   } Stuff;
>   
>
> when I would expect:
>
>   enum {
>      Foo,    ///< This is a very
>              ///< long comment
>      Bar,    ///< This is shorter  
>      BarBar, ///< This is shorter
>   } Stuff;
>   
>
> I see there is no penalty for breaking alignment, which may be accounted for when compressing the whitespace 'before' the comment... Or maybe simply the breaking should be smarter, to try to keep the alignment; but I am not sure it can be done without another kind of 'global' optimization of the comment reflow... Any idea/hint?


I think that's just a bug in comment alignment, which is done at a different stage.


https://reviews.llvm.org/D33589





More information about the cfe-commits mailing list