[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 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] 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
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] 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 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] 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
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] 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] 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 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] 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] 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 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 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] [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: > 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: 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] 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 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] 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] 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] 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] [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] [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
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
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 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
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 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
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-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 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 AlignAfterOpenBracketOptions (PR #108332)

2024-10-17 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From f21e1c62aa64ce497d5d4b500f412752eae9ceb0 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 AlignAfterOpenBracketOptions (PR #108332)

2024-10-17 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108332 >From d4ea6c119580f4e153a0844f0e29cb393c340279 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 MaxSingleLinesInBracedList style option (PR #112482)

2024-10-15 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-10-15 Thread Gedare Bloom via cfe-commits
gedare wrote: I would also be ok to have a style option to make the existing 20-item limit optional (but enabled by default). That might be a little more maintainable than allowing arbitrary limits to be used. There will be bugs if/when people use this option with small values for the limit, a

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

2024-10-15 Thread Gedare Bloom via cfe-commits
gedare wrote: For the history, see https://github.com/llvm/llvm-project/issues/20997 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-10-15 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/112482 The use of Cpp11BracedListStyle with BinPackParameters=False avoids bin packing until reaching a hard-coded limit of 20 items. This is an arbitrary choice. Introduce a new style option to allow setting a configu

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

2024-10-15 Thread Gedare Bloom via cfe-commits
gedare wrote: ping 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)

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] Fix regression in AlwaysBreak for-await (PR #108634)

2024-09-14 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/108634 >From cc3f586d2fee5b89eece3bf341d1ffe1d169e3f7 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 13 Sep 2024 13:41:49 -0600 Subject: [PATCH 1/2] [clang-format] Fix regression in AlwaysBreak for-await Fixes

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

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

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

2024-09-11 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/108332 Introduce sub-options for `AlignAfterOpenBracketBreak` to allow for control of `AlignAfterOpenBracket` with `AlwaysBreak` and `BlockIndent` selectively for `if` conditional statements (as currently supported), o

[clang] [clang-format] Fix regressions in BAS_AlwaysBreak (PR #107506)

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

[clang] [clang-format] Fix regressions in BAS_AlwaysBreak (PR #107506)

2024-09-09 Thread Gedare Bloom via cfe-commits
gedare wrote: LGTM, I like the renaming of the lambda. I think this better captures the original author's intent about "simple functions." https://github.com/llvm/llvm-project/pull/107506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-07-23 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 09bd1f04730f0accad7ce041b0121f716cc7a18d Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 01/12] [clang-format] Improve BlockIndent at ColumnLimit Fixes #557

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-07-23 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 09bd1f04730f0accad7ce041b0121f716cc7a18d Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 01/11] [clang-format] Improve BlockIndent at ColumnLimit Fixes #557

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-07-18 Thread Gedare Bloom via cfe-commits
gedare wrote: I have another PR lined up to submit but it depends on this one. It would be great if we can get some forward progress @owenca https://github.com/llvm/llvm-project/pull/93140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-07-10 Thread Gedare Bloom via cfe-commits
gedare wrote: Rebased to be able to use #97938 https://github.com/llvm/llvm-project/pull/93140 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-07-10 Thread Gedare Bloom via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-07-10 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 6f35c68cff7381453a0bd6a491fee1db6784f42d Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/5] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

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

2024-06-24 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 4a7489251b842da778dd839bd5af3db12ba0fe0b Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 1/5] Add SpaceInParensOption ExceptDoubleParentheses This change al

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-06-20 Thread Gedare Bloom via cfe-commits
@@ -803,6 +803,60 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-06-20 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 27a2da876926d2157ea9f18c5fd71a2e81e097fc Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/4] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

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

2024-06-20 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. > > Yeah, sorry, I posted a comment here but decided it was a bit irrelevant. :) > > But going to ask anyway then. Can this setting remove the

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

2024-06-20 Thread Gedare Bloom via cfe-commits
@@ -4650,10 +4650,23 @@ struct FormatStyle { /// # Should be declared this way: /// SpacesInParens: Custom /// SpacesInParensOptions: + /// ExceptDoubleParentheses: false /// InConditionalStatements: true /// Other: true /// \endcode struct

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

2024-06-20 Thread Gedare Bloom via cfe-commits
gedare wrote: > Do we need all these new test cases? If yes, consider moving the test (and > other `ConfigurableSpacesIn...` tests) to a separate file. I have simplified the additional test cases. https://github.com/llvm/llvm-project/pull/77522 ___ c

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

2024-06-20 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From 4a7489251b842da778dd839bd5af3db12ba0fe0b Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 1/4] Add SpaceInParensOption ExceptDoubleParentheses This change al

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-31 Thread Gedare Bloom via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-31 Thread Gedare Bloom via cfe-commits
@@ -803,6 +803,46 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, return !Tok.Previous->isOneOf(TT_CastRParen, tok::kw_for, tok::kw_while, tok::kw_switch); }; + // Detecting functions is brittle. It wo

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-31 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 27a2da876926d2157ea9f18c5fd71a2e81e097fc Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/3] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-31 Thread Gedare Bloom via cfe-commits
@@ -6157,6 +6157,12 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line, return !(Previous && (Previous->is(tok::kw_for) || Previous->isIf())); } + if (Left.isOneOf(tok::r_paren, TT_TrailingAnnotation) && gedare wrote: yes, it is part of

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

2024-05-31 Thread Gedare Bloom via cfe-commits
gedare wrote: I had to rebase for merge conflicts, so I also cleaned up the commit history a bit. This seems to be working fine and tests pass. https://github.com/llvm/llvm-project/pull/77522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org htt

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

2024-05-31 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77522 >From a2c2ad9cfdb2edcd2facaef00a7ff9e032d0111b Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 17 Jul 2023 18:24:30 -0600 Subject: [PATCH 1/3] Add SpaceInParensOption ExceptDoubleParentheses This change al

[clang] Code implementing SpacesInParensOptions.ExceptDoubleParentheses logic (PR #93439)

2024-05-28 Thread Gedare Bloom via cfe-commits
gedare wrote: I'll try this out in the next few days. https://github.com/llvm/llvm-project/pull/93439 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/92617 >From b4a8c06b79ec10ed2f53a7410bd847ecfa9e8450 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 17 May 2024 17:18:59 -0600 Subject: [PATCH 1/6] [clang-format]: Annotate colons found in inline assembly Short

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Gedare Bloom via cfe-commits
@@ -1488,12 +1488,81 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-25 Thread Gedare Bloom via cfe-commits
@@ -1488,12 +1488,81 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << To

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Gedare Bloom via cfe-commits
gedare wrote: > It seems that you used 5 different assembly snippets and repeated each 3-6 > times. Instead, we can have something like the following: > > ``` > asm{Snippet 1}; > > __asm(Snippet 2); > > __asm__(Snippet 3); > > asm volatile (Snippet 4); > > __asm volatile (Snippet 5); > ```

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Gedare Bloom via cfe-commits
@@ -1488,12 +1488,247 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" - "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << T

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/92617 >From b4a8c06b79ec10ed2f53a7410bd847ecfa9e8450 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 17 May 2024 17:18:59 -0600 Subject: [PATCH 1/5] [clang-format]: Annotate colons found in inline assembly Short

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/92617 >From b4a8c06b79ec10ed2f53a7410bd847ecfa9e8450 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 17 May 2024 17:18:59 -0600 Subject: [PATCH 1/4] [clang-format]: Annotate colons found in inline assembly Short

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Gedare Bloom via cfe-commits
@@ -1426,12 +1428,9 @@ class AnnotatingParser { // the colon are passed as macro arguments. Tok->setType(TT_ObjCMethodExpr); } else if (Contexts.back().ContextKind == tok::l_paren && - !Line.InPragmaDirective) { -if (Style.isTableGe

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-24 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/92617 >From b4a8c06b79ec10ed2f53a7410bd847ecfa9e8450 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 17 May 2024 17:18:59 -0600 Subject: [PATCH 1/3] [clang-format]: Annotate colons found in inline assembly Short

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Gedare Bloom via cfe-commits
@@ -1489,11 +1489,25 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << Toke

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Gedare Bloom via cfe-commits
@@ -1358,6 +1358,8 @@ class AnnotatingParser { Line.First->startsSequence(tok::kw_export, Keywords.kw_module) || Line.First->startsSequence(tok::kw_export, Keywords.kw_import)) { Tok->setType(TT_ModulePartitionColon); + } else if (Line.First->is

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/92617 >From b4a8c06b79ec10ed2f53a7410bd847ecfa9e8450 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 17 May 2024 17:18:59 -0600 Subject: [PATCH 1/2] [clang-format]: Annotate colons found in inline assembly Short

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

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

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

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

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-23 Thread Gedare Bloom via cfe-commits
@@ -1489,11 +1489,25 @@ TEST_F(TokenAnnotatorTest, RequiresDoesNotChangeParsingOfTheRest) { TEST_F(TokenAnnotatorTest, UnderstandsAsm) { auto Tokens = annotate("__asm{\n" "a:\n" - "};"); - ASSERT_EQ(Tokens.size(), 7u) << Toke

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-22 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/93140 >From 27a2da876926d2157ea9f18c5fd71a2e81e097fc Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Tue, 21 May 2024 22:21:59 -0600 Subject: [PATCH 1/2] [clang-format] Improve BlockIndent at ColumnLimit Fixes #55731

[clang] [clang-format] Improve BlockIndent at ColumnLimit (PR #93140)

2024-05-22 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/93140 Fixes #55731 Fixes #73584 The reported formatting problems were related to ignoring deep nesting of "simple" functions (causing #54808) and to allowing the trailing annotation to become separated from the clos

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-17 Thread Gedare Bloom via cfe-commits
gedare wrote: With the patch: ``` $ echo " asm ( a : );" | clang-format -debug ... M=0 C=1 T=InlineASMColon S=1 F=0 B=0 BK=0 P=43 Name=colon L=7 PPK=2 FakeLParens= FakeRParens=1 II=0x0 Text=':' ... $ echo " asm { a : };" | clang-format -debug ... M=0 C=1 T=InlineASMColon S=0 F=1 B=0 BK=0 P=43

[clang] [clang-format]: Annotate colons found in inline assembly (PR #92617)

2024-05-17 Thread Gedare Bloom via cfe-commits
https://github.com/gedare created https://github.com/llvm/llvm-project/pull/92617 Short-circuit the parsing of tok::colon to label colons found within lines starting with asm as InlineASMColon. Fixes #92616. >From b4a8c06b79ec10ed2f53a7410bd847ecfa9e8450 Mon Sep 17 00:00:00 2001 From: Gedare

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

2024-05-17 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

[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 htt

[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 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]: Fix formatting of if statements with BlockIndent (PR #77699)

2024-01-21 Thread Gedare Bloom via cfe-commits
https://github.com/gedare updated https://github.com/llvm/llvm-project/pull/77699 >From ff055d9c064d1fb359d59eeb47cb5f8c6c422bec Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Fri, 7 Jul 2023 17:28:47 -0600 Subject: [PATCH 1/5] Fix formatting of if statements with BlockIndent A bug with Blo

[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 wi

[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 thi

  1   2   >