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

Francois Ferrand via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 08:07:05 PST 2017


Typz added a comment.

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?


https://reviews.llvm.org/D33589





More information about the cfe-commits mailing list