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
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
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
@@ -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
@@ -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
+///
@@ -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
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
@@ -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)))
-
@@ -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)))
-
@@ -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
@@ -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)))
-
@@ -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
+///
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
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
>
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?
>
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?
>
>
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
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
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
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
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
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
@@ -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
@@ -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
@@ -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
@@ -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 &&
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
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
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
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
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
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
32 matches
Mail list logo