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

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 11 05:29:11 PST 2019


MyDeveloperDay added a comment.

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, 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.

Since I also added the dry-run approach, I also think we can use this kind of approach to validate code for conformance (and not necessarily replace the actual code). But at least in the initial tests I've done on relatively large codebases this actually works better than I anticipated.

This is a requested feature both in our bug database but also on stack overflow, this felt like a natural fit (and an interesting challenge)


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

https://reviews.llvm.org/D69764





More information about the cfe-commits mailing list