[clang-format] Add SpacesInParens with SpacesInParensOptions
authorGedare Bloom <gedare@rtems.org>
Tue, 25 Jul 2023 02:13:33 +0000 (19:13 -0700)
committerOwen Pan <owenpiano@gmail.com>
Tue, 25 Jul 2023 02:27:23 +0000 (19:27 -0700)
commitc669541c969c70190933b4a16384c60de80242c0
tree5ece4f09458a01465407fed269a527e9e59e8cdc
parent2398e260806f8beabe017e408225b30897b29198
[clang-format] Add SpacesInParens with SpacesInParensOptions

This is a refactoring of:
- SpacesInConditionalStatement
- SpacesInCStyleCastParentheses
- SpaceInEmptyParentheses
- SpacesInParentheses

These are now options under the new Style Option: SpacesInParens. The
existing options are maintained for backward compatibility.

Within SpacesInParens, there are currently options for:
- Never
- Custom

The currently available options for Custom are:
- InConditionalStatements
- InCStyleCasts
- InEmptyParentheses
- Other

Setting InConditionalStatements and Other to true enables the same space
additions as SpacesInParentheses.

This refactoring does not add or remove any existing features, but it makes
it possible to more easily extend and maintain the addition of spaces within
parentheses.

Related to #55428.

Differential Revision: https://reviews.llvm.org/D155239
clang/docs/ClangFormatStyleOptions.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Format/Format.h
clang/lib/Format/Format.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/ConfigParseTest.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/FormatTestVerilog.cpp