[clang] [clang-format] Add SpacesInParensOption for attributes and filtering for repeated parens (PR #77522)

Gedare Bloom via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 11 16:47:15 PST 2024


gedare wrote:

> > The __attribute((specifier-list)) currently is formatted based on the SpacesInParensOptions.Other (previously, SpacesInParentheses). This change allows finer control over addition of spaces between the consecutive parens, and between the inner parens and the list of attribute specifiers.
> > Differential Revision: https://reviews.llvm.org/D155529
> > This is migrated from Phabricator, see more discussion there.
> 
> I expressed my opinion there:
> 
> > I would have no problem if this new option is extended to handle all double parens, e.g. if (( i = j )), decltype(( x )), etc.
> 
> So I still prefer that we have a boolean suboption (e.g. `ConsecutiveParentheses`) that covers all double parens.

Please have a look, I have moved this PR more toward this direction providing fine-grained controls over double parens.

Someone will have to add the decltype understanding in order to make `decltype(( x ))` work without having to enable `Other.NonConsecutive`.

https://github.com/llvm/llvm-project/pull/77522


More information about the cfe-commits mailing list