[PATCH] D155239: [clang-format] Add SpacesInParens with SpacesInParensOptions
Gedare Bloom via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 17 13:50:23 PDT 2023
gedare added a comment.
I addressed the comments, and I have redesigned this option to simplify it further. Now there are only two options at the top for `SpacesInParens` to be either `Never` or `Custom`. Then within `Custom` the individual behavior of the spaces can be controlled. This allows, for example, someone to actually set every option `true` and really get a space in every parens that is supported. Meanwhile, to get the behavior of what was previously called `SpacesInParentheses` a user would set the spaces in parens options for `InConditionalStatements` and `Other` to be `true`. If `Other` gets further divided in the future, the previous behavior can be retained by simply setting its options to `true` as well.
================
Comment at: clang/include/clang/Format/Format.h:4220
/// \version 3.7
bool SpacesInParentheses;
----------------
HazardyKnusperkeks wrote:
> The deprecated options should be removed from the struct, see `AllowAllConstructorInitializersOnNextLine` for an example.
>
> You also need to adapt the parsing logic a bit.
Got it, thanks for the hint
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:4046
+ ? (Style.SpacesInParens == FormatStyle::SIPO_Always ||
+ Style.SpacesInParentheses)
+ : true;
----------------
MyDeveloperDay wrote:
> isn't SpacesInParentheses mapped to Style.SpacesInParens == FormatStyle::SIPO_Always?
Yes it was, but I misunderstood how to deprecate options. This is fixed now that I removed the deprecated SpacesInParentheses, but it's also been changed to map `SpacesInParentheses` to `Style.SpacesInParens == FormatStyle::SIPO_Custom`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155239/new/
https://reviews.llvm.org/D155239
More information about the cfe-commits
mailing list