[PATCH] D69764: [clang-format] Add East/West Const fixer capability

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 28 10:56:46 PDT 2020


MyDeveloperDay marked an inline comment as done.
MyDeveloperDay added inline comments.


================
Comment at: clang/lib/Format/EastWestConstFixer.cpp:195
+                                FormatToken *Tok) {
+  // We only need to think about streams that begin with const.
+  if (!Tok->is(tok::kw_const)) {
----------------
curdeius wrote:
> MyDeveloperDay wrote:
> > curdeius wrote:
> > > Why? What about `unsigned const int`?
> > @curdeius would you help me understand your expectation here?
> > 
> >  - east: `unsigned int const`
> >  - west: `const unsigned int`
> > 
> > ?
> Yes, precisely this. And as for all other cases, I would only move `const`, nothing else.
Ok that will now will work (but I'll add these specific unit tests to prove it)

`unsigned const int`

will see `unsigned const` and then swap it to be `const unsigned`

resulting in 

`const unsigned int`

similar will happen in the "east" const sense too (but again I'll add the tests)




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

https://reviews.llvm.org/D69764





More information about the cfe-commits mailing list