[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
Tue Dec 10 01:56:15 PST 2019
MyDeveloperDay added a comment.
> But I don't know if this can be (easily) supported in a .clang-format file, since the style options are defined as (static) enums. I realize my proposal might be out of the scope of this patch, but I wanted to get some opinions from the community.
just thinking out loud, I think this could be achieved in the config by a list of dictionaries
QualifierStyle:
- const: Right
- volatile: Right
- __as1: Right
- __as2: Right
I think we'd need some ordering information (which is why I was thinking maybe having this in a list (so the order of the list defines the left -> right order)
`const __as1 int foo;` -> `int const __as1 foo; `
if the order is:
QualifierStyle:
- { "const": "Right" }
- { "__as1": "Right" }
but
`const __as1 int foo;` -> `int __as1 const foo; `
if the order is
QualifierStyle:
- { "__as1": "Right" }
- { "const": "Right" }
I think this would likely make everything much more complicated, but perhaps we should think about this for the configuration at least now so we future proof ourselves.
QualifierStyle:
- { "__as1": "Left" }
- { "const": "Right" }
- { "__as2": "Left" }
- { "volatile": "Left" }
would give
`const volatile __as1 int foo;` -> `__as1 volatile int const foo; `
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69764/new/
https://reviews.llvm.org/D69764
More information about the cfe-commits
mailing list