[clang] [clang-format] add MaxSingleLinesInBracedList style option (PR #112482)

2024-10-26 Thread Gedare Bloom via cfe-commits
gedare wrote: > > There will be bugs if/when people use this option with small values for the > > limit, as it will interact weirdly with both the braced list initializer > > formatting rules, and also with the `AvoidBinPacking` logic of the > > continuation indenter. > > Can you give some ex

[clang] [clang-format] add MaxSingleLinesInBracedList style option (PR #112482)

2024-10-26 Thread Gedare Bloom via cfe-commits
gedare wrote: So it turns out that this buggy behavior I'm seeing is also present in unmodified clang-format when the first item in the list is longer than the rest of the items. For example: ``` echo "vector x{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-09-23 Thread Gedare Bloom via cfe-commits
gedare wrote: Rebased to main to pick up recent regression fixes BlockIndent/AlwaysBreak. https://github.com/llvm/llvm-project/pull/108332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commi

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-09-23 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From d099408d791fef55b3064f6597bdd2fb0b4537da Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/2] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] Fix regression with BlockIndent of Braced Initializers (PR #108717)

2024-09-22 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108717 >From a95b990e48df19b8b674fe9df6bea803415129bf Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Sat, 14 Sep 2024 13:13:26 -0600 Subject: [PATCH 1/3] [clang-format] Fix regression with BlockIndent of Braced Init

[clang] [clang-format] Fix regression with BlockIndent of Braced Initializers (PR #108717)

2024-09-22 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108717 >From a95b990e48df19b8b674fe9df6bea803415129bf Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Sat, 14 Sep 2024 13:13:26 -0600 Subject: [PATCH 1/2] [clang-format] Fix regression with BlockIndent of Braced Init

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

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

[clang] [clang-format] add MaxSingleLinesInBracedList style option (PR #112482)

2024-12-02 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From 5f868e9ce386923052f1b14936f04b129c7d6c00 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

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

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-02 Thread Gedare Bloom via cfe-commits
gedare wrote: I decided to go the simpler route and create a boolean option that can be used to disable the hard-coded limit of 20 items. https://github.com/llvm/llvm-project/pull/112482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-02 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From 5f868e9ce386923052f1b14936f04b129c7d6c00 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/4] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-02 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From c03df35a47e9486fb2117ea8f00fedaf445696c6 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-02 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 70e0cbd5c648a532952ddb00a719b03a8f31160e Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/2] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-02 Thread Gedare Bloom via cfe-commits
gedare wrote: I'm content with this solution. https://github.com/llvm/llvm-project/pull/112482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-02 Thread Gedare Bloom via cfe-commits
gedare wrote: Rebased to main. This PR addresses several long-standing issues. It would be great to get a review. https://github.com/llvm/llvm-project/pull/108332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2024-12-02 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/118409 The penalty for breaking before a member access is hard-coded to 150. Add a configuration option to allow setting it. >From dfa4d88b072e99c1c425b85003090a46ca4ec252 Mon Sep 17 00:00:00 2001 From: Gedare Bloom D

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

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

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2024-12-02 Thread Gedare Bloom via cfe-commits
@@ -4280,7 +4280,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, // aaa // .a.(); return !Right.NextOperator || !Right.NextOperator->Previous->closesScope() - ? 150 + ? Style.Pena

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-09 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/119044 >From c6b628536daf5640c383fd7abe629e84d1505ae2 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 6 Dec 2024 16:52:35 -0700 Subject: [PATCH 1/2] [clang-format] Reorder TokenAnnotator::canBreakBefore Move the

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-09 Thread Gedare Bloom via cfe-commits
@@ -6105,6 +6105,33 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return false; } + // We only break before r_brace if there was a corresponding break before + // the l_brace, which is tracked by BreakBeforeClosingBrace. gedare w

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-09 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/119044 >From c5bf1fc70df08ef94cc32a47d1bdce69c92c2abf Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 6 Dec 2024 16:52:35 -0700 Subject: [PATCH] [clang-format] Reorder TokenAnnotator::canBreakBefore Move the che

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-07 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From 9fb82b16dfea2115431219bd9915d18eff081805 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-07 Thread Gedare Bloom via cfe-commits
@@ -3398,6 +3401,21 @@ struct FormatStyle { /// \version 3.7 unsigned MaxEmptyLinesToKeep; + /// If ``BinPackArguments`` is ``false`` this option can override it if + /// ``true`` when 20 or more items are in a braced initializer list. + /// \code + ///BinPackLongB

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-07 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From 59770d0e915b2cb50b89c2c98ed20f7d9170d744 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-07 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From b61cb81d93e6fb137af282a4f2f0ebf151c2543c Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

2025-01-30 Thread Gedare Bloom via cfe-commits
@@ -9608,6 +9608,10 @@ TEST_F(FormatTest, AlignsAfterOpenBracket) { "\"a aaa a aaa a\"\n" ");", Style); + verifyFormat("aaa(\n" + "&b

[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

2025-01-30 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/124998 >From 69658e8c2beb787b90ea29765bf428892d4e5ec4 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Wed, 29 Jan 2025 14:53:10 -0700 Subject: [PATCH 1/2] [clang-format] Fix mismatched break in BlockIndent Near the C

[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

2025-01-30 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/124998 >From 69658e8c2beb787b90ea29765bf428892d4e5ec4 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Wed, 29 Jan 2025 14:53:10 -0700 Subject: [PATCH 1/3] [clang-format] Fix mismatched break in BlockIndent Near the C

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-04 Thread Gedare Bloom via cfe-commits
gedare wrote: > What about changing it to an option (e.g. `BinPackBracedListThreshold`) with > a default value of about 20? If the number of elements in the list is more > than the threshold, they will be bin packed even if `BinPackArguments` is set > to false. That was my original approach,

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/4] [clang-format] add BinPackLongBracedList style option The use

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/6] [clang-format] add BinPackLongBracedList style option The use

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From 8282f754ae40b64a88e2d22a6cb21e7028da8371 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/7] [clang-format] add BinPackLongBracedList style option The use

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-02-07 Thread Gedare Bloom via cfe-commits
gedare wrote: Review comments addressed. Nice splitting of the test case. https://github.com/llvm/llvm-project/pull/112482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-02-09 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 5cec30f5d93a22f10a985cb3e4418e7d29d31a00 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/7] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] Detect nesting in template strings (PR #119989)

2024-12-14 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/119989 >From fa8d1b12eee0164f2b4c8223281d0e59dfa693e1 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Sat, 14 Dec 2024 15:25:44 -0700 Subject: [PATCH 1/2] [clang-format] detect nesting in template strings The helper

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-14 Thread Gedare Bloom via cfe-commits
gedare wrote: > I don't think this is the way to go, or at least not with this name. > > How about going the `Custom` way? Adding a `Custom` option to `AlignAfterOpenBracket` is an interesting proposal. There have been some ideas floated in other Issues and PRs related to this, for example: *

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-14 Thread Gedare Bloom via cfe-commits
@@ -811,10 +816,11 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, if (!Tok.Previous) return true; if (Tok.Previous->isIf()) - return Style.AlignAfterOpenBracket == FormatStyle::BAS_AlwaysBreak; -return !Tok.Previous->i

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2024-12-14 Thread Gedare Bloom via cfe-commits
@@ -1452,6 +1476,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { FormatStyle LLVMStyle; LLVMStyle.AccessModifierOffset = -2; LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align; + LLVMStyle.AlignAfterOpenBracketBreak = {}; gedar

[clang] [clang-format] detect nesting in template strings (PR #119989)

2024-12-14 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/119989 The helper to check if a token is in a template string scans too far backward. It should stop if a different scope is found. Fixes #107571 >From fa8d1b12eee0164f2b4c8223281d0e59dfa693e1 Mon Sep 17 00:00:00 2001

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-14 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From d625f811a615155b15a007ec3afc9874c52d06c4 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-14 Thread Gedare Bloom via cfe-commits
@@ -1208,6 +1208,21 @@ struct FormatStyle { /// \version 3.7 bool BinPackArguments; + /// If ``BinPackArguments`` is ``false`` this option can override it if + /// ``true`` when 20 or more items are in a braced initializer list. gedare wrote: I rewrote

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2024-12-14 Thread Gedare Bloom via cfe-commits
gedare wrote: > I think it should be merges with `BinPackArguments` to get an enum > > * Never > * TwentyOrAbove (name is debatable) > * Always > * (Leave?) Currently the 20 item limit is only enforced on C++ initializer lists. Making it part of the `BinPackArguments` means it has to apply to

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-06 Thread Gedare Bloom via cfe-commits
gedare wrote: Without this patch, the test case on `main`: ``` [ RUN ] FormatTest.AlignsAfterOpenBracket /home/gedare/rtems/llvm-project/clang/unittests/Format/FormatTestBase.h:90: Failure Expected equality of these values: ExpectedCode Which is: "void foo(\nvoid (*foobarpntr)(\n

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-06 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/119044 >From 6233d3dc731ae15368231b9e956379d71e905311 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 6 Dec 2024 16:52:35 -0700 Subject: [PATCH] [clang-format] Reorder TokenAnnotator::canBreakBefore Move the che

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-06 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/119044 Move the checks related to breaking before right braces and right parens earlier to avoid conflicting checks that prevent breaking based on the left-hand token. This allows properly formatting declarations with

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-06 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/119044 >From c6b628536daf5640c383fd7abe629e84d1505ae2 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 6 Dec 2024 16:52:35 -0700 Subject: [PATCH] [clang-format] Reorder TokenAnnotator::canBreakBefore Move the che

[clang] [clang-format] Reorder TokenAnnotator::canBreakBefore (PR #119044)

2024-12-06 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/119044 >From bd86e432e8ef5bc960e2ccaeca77f3b7cf51333f Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 6 Dec 2024 16:52:35 -0700 Subject: [PATCH] [clang-format] Reorder TokenAnnotator::canBreakBefore Move the che

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-06 Thread Gedare Bloom via cfe-commits
gedare wrote: Would this also be equivalent to supporting `AlignAfterOpenBracket: BlockIndent` for angle brackets? https://github.com/llvm/llvm-project/pull/118046 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-06 Thread Gedare Bloom via cfe-commits
gedare wrote: > Yes. I followed the code that implements `AlignAfterOpenBracket: > BlockIndent`, except applying to ClosesTemplateDeclaration. I made it a new > setting for backwards compatibility. 👍 Maybe we should make it a sub-option for `BlockIndent`. I'm seeing a possible need for having

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-06 Thread Gedare Bloom via cfe-commits
gedare wrote: > > Yes. I followed the code that implements `AlignAfterOpenBracket: > > BlockIndent`, except applying to ClosesTemplateDeclaration. I made it a new > > setting for backwards compatibility. 👍 > > Maybe we should make it a sub-option for `BlockIndent`. I'm seeing a possible > nee

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2024-12-06 Thread Gedare Bloom via cfe-commits
gedare wrote: I think you should add test cases with multiple `>>` closing, see `UnderstandsTemplateParameters` for example. Consider trying the code snippet mentioned in https://github.com/llvm/llvm-project/issues/80049 as well. https://github.com/llvm/llvm-project/pull/118046 _

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-22 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/118409 >From 978e0415002be5ee51d226d15121392a8a0c2c85 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 2 Dec 2024 15:16:39 -0700 Subject: [PATCH 1/3] [clang-format] Add PenaltyBreakBeforeMemberAccess Add a config

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-22 Thread Gedare Bloom via cfe-commits
gedare wrote: > Please rebase and run `ninja clang-format-style`. Done. https://github.com/llvm/llvm-project/pull/118409 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
@@ -22365,6 +22365,19 @@ TEST_F(FormatTest, BreakPenaltyAfterForLoopLParen) { Style); } +TEST_F(FormatTest, BreakPenaltyBeforeMemberAccess) { gedare wrote: I'm confused by the sorting request. I put it where it is lexicographically sorted. ht

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
@@ -4316,7 +4316,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, // aaa // .a.(); return !Right.NextOperator || !Right.NextOperator->Previous->closesScope() - ? 150 + ? Style.Pena

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
@@ -4316,7 +4316,7 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line, // aaa // .a.(); return !Right.NextOperator || !Right.NextOperator->Previous->closesScope() - ? 150 + ? Style.Pena

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/118409 >From 86bc2d2fe03d84879870eec1a8c10912076686c2 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 2 Dec 2024 15:16:39 -0700 Subject: [PATCH 1/5] [clang-format] Add PenaltyBreakBeforeMemberAccess Add a config

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
@@ -22365,6 +22365,19 @@ TEST_F(FormatTest, BreakPenaltyAfterForLoopLParen) { Style); } +TEST_F(FormatTest, BreakPenaltyBeforeMemberAccess) { + FormatStyle Style = getLLVMStyle(); + Style.ColumnLimit = 8; + Style.PenaltyExcessCharacter = 15; + verifyFormat("

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-01-27 Thread Gedare Bloom via cfe-commits
gedare wrote: @owenca if you could take another look at this PR I'd appreciate it. https://github.com/llvm/llvm-project/pull/112482 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-27 Thread Gedare Bloom via cfe-commits
gedare wrote: There's a problem between this implementation and the fix in #119989 that I need to figure out. https://github.com/llvm/llvm-project/pull/108332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-01-27 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From eb789f3dd6aab070865fc92270aa20f872f30dab Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/118409 >From 86bc2d2fe03d84879870eec1a8c10912076686c2 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 2 Dec 2024 15:16:39 -0700 Subject: [PATCH 1/4] [clang-format] Add PenaltyBreakBeforeMemberAccess Add a config

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/118409 >From 86bc2d2fe03d84879870eec1a8c10912076686c2 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 2 Dec 2024 15:16:39 -0700 Subject: [PATCH 1/7] [clang-format] Add PenaltyBreakBeforeMemberAccess Add a config

[clang] Add configuration option PenaltyBreakBeforeMemberAccess (PR #118409)

2025-01-27 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/118409 >From 86bc2d2fe03d84879870eec1a8c10912076686c2 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 2 Dec 2024 15:16:39 -0700 Subject: [PATCH 1/6] [clang-format] Add PenaltyBreakBeforeMemberAccess Add a config

[clang] [clang-format] Fix parsing attrs in class/struct (PR #124634)

2025-01-27 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/124634 An attribute in a class/struct declaration confuses the parser to treat the identifier following the attribute as a function or variable name. Fixes #124574 >From db6e09dca9d39b1c21543a069e7a1d1bf3997c0c Mon Se

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-28 Thread Gedare Bloom via cfe-commits
gedare wrote: > I'd add an annotating test. (And drop the formatting test.) Yes, that's a good idea, I've done it. I started with the formatting test, but it is unnecessary (although a good, complicated bit of formatting) since the bug was in the annotation. https://github.com/llvm/llvm-proje

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-28 Thread Gedare Bloom via cfe-commits
https://github.com/gedare deleted https://github.com/llvm/llvm-project/pull/108332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-28 Thread Gedare Bloom via cfe-commits
@@ -1169,6 +1181,18 @@ template <> struct MappingTraits { IO.mapOptional("WhitespaceSensitiveMacros", Style.WhitespaceSensitiveMacros); +// If AlignAfterOpenBracket was specified but AlignAfterOpenBracketBreak +// was not, initialize the latter f

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-28 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From c7b34d10bb8f937f9a11778c327f82cee8e60fe5 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/5] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-28 Thread Gedare Bloom via cfe-commits
@@ -1452,6 +1476,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind Language) { FormatStyle LLVMStyle; LLVMStyle.AccessModifierOffset = -2; LLVMStyle.AlignAfterOpenBracket = FormatStyle::BAS_Align; + LLVMStyle.AlignAfterOpenBracketBreak = {}; gedar

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-28 Thread Gedare Bloom via cfe-commits
@@ -1169,6 +1181,18 @@ template <> struct MappingTraits { IO.mapOptional("WhitespaceSensitiveMacros", Style.WhitespaceSensitiveMacros); +// If AlignAfterOpenBracket was specified but AlignAfterOpenBracketBreak +// was not, initialize the latter f

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-28 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/124634 >From 5292f110ce4c7f5b060165e3c3f817b6716c2c1e Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 27 Jan 2025 14:49:54 -0700 Subject: [PATCH 1/2] [clang-format] Fix annotating attrs in class/struct An attrib

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-28 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From c7b34d10bb8f937f9a11778c327f82cee8e60fe5 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/3] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-28 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From c7b34d10bb8f937f9a11778c327f82cee8e60fe5 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/4] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 8ca6e30c6fbe1e51b711c5c15cdeb6517097f3e8 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/5] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-29 Thread Gedare Bloom via cfe-commits
gedare wrote: Rebased to `main` for `21.0.0git` https://github.com/llvm/llvm-project/pull/108332 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add BreakBeforeTemplateClose option (PR #118046)

2025-01-29 Thread Gedare Bloom via cfe-commits
@@ -11220,6 +11220,333 @@ TEST_F(FormatTest, WrapsTemplateDeclarationsWithComments) { Style); } +TEST_F(FormatTest, BreakBeforeTemplateCloser) { + FormatStyle Style = getGoogleStyle(FormatStyle::LK_Cpp); + // Begin with tests covering the case where there is no constr

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 8ca6e30c6fbe1e51b711c5c15cdeb6517097f3e8 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/7] Format: add AlignAfterOpenBracketOptions Introduce new option

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From a01d46f6dfe7f383557b7e98df01b73a4f238cdf Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/5] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] Fix mismatched break in BlockIndent (PR #124998)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/124998 Near the ColumnLimit a break could be inserted before a right parens with BlockIndent without a break after the matching left parens. Avoid these hanging right parens by disallowing breaks before right parens un

[clang] [clang-format] add BinPackLongBracedLists style option (PR #112482)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/112482 >From a01d46f6dfe7f383557b7e98df01b73a4f238cdf Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 15 Oct 2024 23:55:49 -0600 Subject: [PATCH 1/3] [clang-format] add BinPackLongBracedLists style option The us

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare closed https://github.com/llvm/llvm-project/pull/124634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-29 Thread Gedare Bloom via cfe-commits
gedare wrote: The improved fix is in https://github.com/llvm/llvm-project/pull/124891. https://github.com/llvm/llvm-project/pull/124634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-29 Thread Gedare Bloom via cfe-commits
gedare wrote: I'll rebase on the other PR after it merges. https://github.com/llvm/llvm-project/pull/124634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add ClassHeadName to help annotating StartOfName (PR #124891)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare approved this pull request. https://github.com/llvm/llvm-project/pull/124891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-29 Thread Gedare Bloom via cfe-commits
gedare wrote: See https://github.com/llvm/llvm-project/pull/124891. https://github.com/llvm/llvm-project/pull/124634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare reopened https://github.com/llvm/llvm-project/pull/124634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Fix annotating attrs in class/struct (PR #124634)

2025-01-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare closed https://github.com/llvm/llvm-project/pull/124634 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-02-19 Thread Gedare Bloom via cfe-commits
gedare wrote: > I prefer that we limit this to breaking after the left parenthesis of a > control statement, with true/false or Always, Never, Multiline, BlockIndent, > etc. if I understand you correctly, you would like a new style option added for setting break option for all control stateme

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-30 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 8846ff045f969b258554c3cfb72161e9f61dda19 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/2] Format: add AlignAfterControlStatement Introduce new style op

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 64000ad7d2310ac916b37ed808997bfcb6b9f324 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/2] Format: add AlignAfterControlStatement Introduce new style op

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 64000ad7d2310ac916b37ed808997bfcb6b9f324 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/3] Format: add AlignAfterControlStatement Introduce new style op

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-29 Thread Gedare Bloom via cfe-commits
gedare wrote: > > > I prefer that we limit this to breaking after the left parenthesis of a > > > control statement, with true/false or Always, Never, Multiline, > > > BlockIndent, etc. > > > > > > if I understand you correctly, you would like a new style option added for > > setting break

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-29 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 64000ad7d2310ac916b37ed808997bfcb6b9f324 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/4] Format: add AlignAfterControlStatement Introduce new style op

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-30 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From 8846ff045f969b258554c3cfb72161e9f61dda19 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/3] Format: add AlignAfterControlStatement Introduce new style op

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-30 Thread Gedare Bloom via cfe-commits
@@ -5283,6 +5299,7 @@ struct FormatStyle { bool operator==(const FormatStyle &R) const { return AccessModifierOffset == R.AccessModifierOffset && AlignAfterOpenBracket == R.AlignAfterOpenBracket && + AlignAfterControlStatement == R.AlignAfterControlSt

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-30 Thread Gedare Bloom via cfe-commits
gedare wrote: When I updated, my build target for `FormatTests` stopped working. ``` ninja -C build clang-format FormatTests ninja: Entering directory `build' ninja: error: unknown target 'FormatTests' ``` I'm trying to figure out what changed or how to modify my workflow. I think I ran this PR

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-04-30 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From b2cbc7730aca7c75679c070292cfd07cf55854af Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Thu, 20 Jun 2024 17:35:39 -0600 Subject: [PATCH 1/2] Format: add AlignAfterControlStatement Introduce new style op

[clang] [clang-format] Add AlignAfterOpenBracketOptions (PR #108332)

2025-05-01 Thread Gedare Bloom via cfe-commits
gedare wrote: > Why would `AlignAfterControlStatement` have anything to do with > `AlignAfterOpenBracket`, which is for arguments of function/macro calls? > Unfortunately, `AlignAfterOpenBracket` is not just for arguments of function/macro calls. It affects parentheses of control statements a

<    1   2