[PATCH] D69764: [clang-format] Add Left/Right Const (East/West , Before/After) fixer capability

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 05:56:20 PST 2019


sammccall added a comment.

In D69764#1740594 <https://reviews.llvm.org/D69764#1740594>, @MyDeveloperDay wrote:

> In D69764#1740582 <https://reviews.llvm.org/D69764#1740582>, @sammccall wrote:
>
> > (Sorry for arriving at this late)
> >
> > At a strategic level, I have some concerns here: the fact that clang-format generally doesn't touch the token sequence isn't an accident.
> >  e.g. formatting `int x;;` will insert a newline rather than deleting the redundant semicolon. Like the one in this patch, that would be a useful feature, but it's a path the clang-format authors deliberately decided to close off.
>
>
> I would agree that in the beginning that was true, but now with sorting of includes/using we are making replacements to move things around,


Yes. Making include-sorting a style option (and then turning that option on for google style) has been controversial and in hindsight a mistake IMO. I believe making it (only) a command-line flag is an option we should consider now (and should have considered then).

There are important differences here: include insertion (and I think using too) is less likely to hit pseudoparser problems, but more likely that bad fixes change program behavior.

> The fact we are using the same Replacement ideas that clang-tidy uses for fix-its I feel this isn't a huge change of direction.

clang-tidy and clang-format are very different tools with very different philosophies. clang-tidy is fairly successful and widely used, but clang-format much more so.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69764/new/

https://reviews.llvm.org/D69764





More information about the cfe-commits mailing list