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

2024-03-30 Thread Gedare Bloom via cfe-commits
gedare wrote: I saw some comments on this. Looks like some were deleted maybe. This is still in my queue, but unclear when I'll get back to it. https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

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

2024-03-29 Thread Alibek Omarov via cfe-commits
a1batross wrote: I have built clang-format with these changes. On current commit, it sadly doesn't remove the space in these patterns: ```c memset( g_used, 0, sizeof( g_used ) ); if( FBitSet( ent->curstate.effects, EF_INVLIGHT ) ) ``` After reverting last commit, it got somewhat closer: ```c

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

2024-03-28 Thread Alibek Omarov via cfe-commits
a1batross wrote: Any news on this? https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-01-25 Thread Owen Pan via cfe-commits
@@ -4569,23 +4602,40 @@ struct FormatStyle { bool InEmptyParentheses; /// Put a space in parentheses not covered by preceding options. /// \code -///true: false: -///t f( Deleted & ) & = delete; vs. t f(Deleted

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

2024-01-25 Thread Owen Pan via cfe-commits
@@ -4542,18 +4542,51 @@ struct FormatStyle { /// Other: true /// \endcode struct SpacesInParensCustom { +/// Override any of the following options to prevent addition of space +/// between the first two parentheses in situations where a pair of +///

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

2024-01-25 Thread Owen Pan via cfe-commits
@@ -4569,23 +4602,40 @@ struct FormatStyle { bool InEmptyParentheses; /// Put a space in parentheses not covered by preceding options. /// \code -///true: false: -///t f( Deleted & ) & = delete; vs. t f(Deleted

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

2024-01-25 Thread Owen Pan via cfe-commits
owenca wrote: > This would be greatly simplified if we can annotate the `DoubleParenthesis` > situation inside of `UnwrappedLineParser::parseParens`. +1. https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list

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

2024-01-23 Thread Björn Schäpers via cfe-commits
@@ -4006,11 +3993,58 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine , } if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { -return (Right.is(TT_CastRParen) || -(Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) -

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

2024-01-23 Thread Björn Schäpers via cfe-commits
@@ -4006,11 +3993,58 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine , } if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { -return (Right.is(TT_CastRParen) || -(Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) -

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

2024-01-23 Thread Björn Schäpers via cfe-commits
@@ -4542,18 +4542,51 @@ struct FormatStyle { /// Other: true HazardyKnusperkeks wrote: Add the options here too? https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list

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

2024-01-23 Thread Björn Schäpers via cfe-commits
@@ -4006,11 +3993,58 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine , } if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { -return (Right.is(TT_CastRParen) || -(Left.MatchingParen && Left.MatchingParen->is(TT_CastRParen))) -

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

2024-01-23 Thread Björn Schäpers via cfe-commits
@@ -4542,18 +4542,51 @@ struct FormatStyle { /// Other: true /// \endcode struct SpacesInParensCustom { +/// Override any of the following options to prevent addition of space +/// between the first two parentheses in situations where a pair of +///

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

2024-01-22 Thread Gedare Bloom via cfe-commits
gedare wrote: * Rebased to resolve conflict in ReleaseNotes. * Added `ExceptDoubleParentheses` as proposed by @owenca This seems to work reasonably well for the cases I care about, as far as I can tell. https://github.com/llvm/llvm-project/pull/77522

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

2024-01-21 Thread Owen Pan via cfe-commits
owenca wrote: > > It seems adding a boolean sub-option that targets double pairs of > > parentheses as I suggested before is feasible although a better name than > > `ConsecutiveParentheses` may be needed. > > I'm fine to fix but request a concrete suggestion or proposal before I spend >

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

2024-01-21 Thread Gedare Bloom via cfe-commits
gedare wrote: > > > Would `__attribute__((noreturn))`, `if ((i = j))`, `decltype((x))`, and > > > `while (((i + 1) * j - 2) * k > 3)` be formatted as `__attribute__(( > > > noreturn ))`, `if (( i = j ))`, `decltype(( x ))`, and `while ( ( ( i + 1 > > > ) * j - 2 ) * k > 3 )`, respectively? >

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

2024-01-21 Thread Owen Pan via cfe-commits
owenca wrote: > > Would `__attribute__((noreturn))`, `if ((i = j))`, `decltype((x))`, and > > `while (((i + 1) * j - 2) * k > 3)` be formatted as `__attribute__(( > > noreturn ))`, `if (( i = j ))`, `decltype(( x ))`, and `while ( ( ( i + 1 ) > > * j - 2 ) * k > 3 )`, respectively? > >

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

2024-01-21 Thread Gedare Bloom via cfe-commits
gedare wrote: > > The code is [self-hosted](https://git.rtems.org/rtems/) and [mirrored on > > GitHub](https://github.com/RTEMS/rtems) with a [documented style > > guide](https://docs.rtems.org/branches/master/eng/coding-formatting.html). > > In addition, I have been and will continue to be

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

2024-01-20 Thread Owen Pan via cfe-commits
owenca wrote: > The code is [self-hosted](https://git.rtems.org/rtems/) and [mirrored on > GitHub](https://github.com/RTEMS/rtems) with a [documented style > guide](https://docs.rtems.org/branches/master/eng/coding-formatting.html). In > addition, I have been and will continue to be willing

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

2024-01-20 Thread Gedare Bloom via cfe-commits
gedare wrote: > > Covering all double parens in a single sub-option is not precise enough for > > code bases that may want to have `__attribute__(( x ))` but also allow `if > > ( ( x ) )`. > > We should not go overboard with supporting all kinds of options/suboptions > imaginable. I don't

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

2024-01-20 Thread Owen Pan via cfe-commits
owenca wrote: > Covering all double parens in a single sub-option is not precise enough for > code bases that may want to have `__attribute__(( x ))` but also allow `if ( > ( x ) )`. We should not go overboard with supporting all kinds of options/suboptions imaginable. I don't think we

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

2024-01-13 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-01-12 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 5e5bec9fba56f34c7dd28ca866eef145035a Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 01/15] Add SpaceInParensOption for __attribute__ keyword The

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

2024-01-12 Thread Björn Schäpers via cfe-commits
@@ -17016,6 +17056,158 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) { verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces); + + // Check NonConsecutive

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

2024-01-12 Thread Björn Schäpers via cfe-commits
@@ -17001,6 +17056,158 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) { verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces); + + // Check NonConsecutive

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

2024-01-12 Thread Björn Schäpers via cfe-commits
@@ -17016,6 +17056,158 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) { verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*foo)(a - 1);", Spaces); verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces); + + // Check NonConsecutive

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

2024-01-12 Thread Björn Schäpers via cfe-commits
@@ -4007,26 +3992,45 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine , return true; } - // TODO: check consecutive parens if (Left.is(tok::l_paren) || Right.is(tok::r_paren)) { -if (Right.is(TT_CastRParen) || -(Left.MatchingParen &&

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

2024-01-11 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 5e5bec9fba56f34c7dd28ca866eef145035a Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 01/14] Add SpaceInParensOption for __attribute__ keyword The

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

2024-01-11 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 5e5bec9fba56f34c7dd28ca866eef145035a Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 01/13] Add SpaceInParensOption for __attribute__ keyword The

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

2024-01-11 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 5e5bec9fba56f34c7dd28ca866eef145035a Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 01/12] Add SpaceInParensOption for __attribute__ keyword The

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

2024-01-11 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 5e5bec9fba56f34c7dd28ca866eef145035a Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 01/11] Add SpaceInParensOption for __attribute__ keyword The

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

2024-01-11 Thread Gedare Bloom via cfe-commits
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

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

2024-01-11 Thread Gedare Bloom via cfe-commits
https://github.com/gedare edited https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits