[PATCH] D88227: [clang-format] Add a SpaceBeforePointerQualifiers style option

Alexander Richardson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 15:45:55 PDT 2020


arichardson added inline comments.


================
Comment at: clang/include/clang/Format/Format.h:2181
+  /// \endcode
+  bool SpaceBeforePointerQualifiers;
+
----------------
MyDeveloperDay wrote:
> I wonder if a request would ever say they wanted this Space before to be Left/Middle/Right? perhaps this should not be a bool?
> 
> ```
> void* const *x;
> void * const *x;
> void *const *x;
> ```
> 
> ```
> void* const *x;
> void * const *x;
> void *const *x;
> ```
> 
> ```
> void* const * x;
> void * const * x;
> void *const * x;
> ```
> 
> ```
> void* const* x;
> void * const* x;
> void *const* x;
> ```
Shouldn't be too hard to implement so why not. How about PointerAlignmentForQualifiers as the setting name?

We will have to ensure that the default value matches PointerAlignment if it's not set since otherwise you'd get really weird code formatting after updating clang-format if you don't change the config file.
Are there and other settings that behave this way? If not I think I'd rather keep the boolean option.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88227



More information about the cfe-commits mailing list