[PATCH] D155239: [clang-format] Add SpacesInParens with SpacesInParensOptions

Gedare Bloom via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 13 15:13:29 PDT 2023


gedare created this revision.
Herald added projects: All, clang, clang-format.
Herald added a subscriber: cfe-commits.
Herald added reviewers: rymiel, HazardyKnusperkeks, owenpan, MyDeveloperDay.
gedare requested review of this revision.

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
- ConditionalStatements
- CStyleCasts
- EmptyParentheses
- Always
- Custom

Always enables the same space additions as SpacesInParentheses. The currently
available options for Custom are:

- InConditionalStatements
- InCStyleCasts
- InEmptyParentheses

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.

This rev is related to Github Issue 55428.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155239

Files:
  clang/docs/ClangFormatStyleOptions.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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155239.540195.patch
Type: text/x-patch
Size: 24735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230713/80259470/attachment-0001.bin>


More information about the cfe-commits mailing list