Skip to content

Commit 4da9f0e

Browse files
committed
dump clang-format-style
1 parent d0fcee6 commit 4da9f0e

File tree

2 files changed

+153
-34
lines changed

2 files changed

+153
-34
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 149 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -197,48 +197,29 @@ the configuration (without a prefix: ``Auto``).
197197

198198
.. _AlignAfterOpenBracket:
199199

200-
**AlignAfterOpenBracket** (``BracketAlignmentStyle``) :versionbadge:`clang-format 3.8` :ref:`<AlignAfterOpenBracket>`
200+
**AlignAfterOpenBracket** (``Boolean``) :versionbadge:`clang-format 3.8` :ref:`<AlignAfterOpenBracket>`
201201
If ``true``, horizontally aligns arguments after an open bracket.
202202

203-
This applies to round brackets (parentheses), angle brackets and square
204-
brackets.
205-
206-
Possible values:
207-
208-
* ``BAS_Align`` (in configuration: ``Align``)
209-
Align parameters on the open bracket, e.g.:
210-
211-
.. code-block:: c++
212-
213-
someLongFunction(argument1,
214-
argument2);
215-
216-
* ``BAS_DontAlign`` (in configuration: ``DontAlign``)
217-
Don't align, instead use ``ContinuationIndentWidth``, e.g.:
218203

219-
.. code-block:: c++
204+
.. code-block:: c++
220205

221-
someLongFunction(argument1,
222-
argument2);
206+
true: vs. false
207+
someLongFunction(argument1, someLongFunction(argument1,
208+
argument2); argument2);
223209

224-
* ``BAS_ABDeprecated`` (in configuration: ``ABDeprecated``)
225-
``BAS_AlwaysBreak``
226-
This is **deprecated**. See ``BreakAfterOpenBracketBracedList``,
227-
``BreakAfterOpenBracketFunction``, ``BreakAfterOpenBracketIf``,
228-
``BreakAfterOpenBracketLoop``, ``BreakAfterOpenBracketSwitch``.
229-
For backward compatibility. Do not use.
230210

231-
* ``BAS_BIDeprecated`` (in configuration: ``BIDeprecated``)
232-
``BAS_BlockIndent``
233-
This is **deprecated**. See ``BreakAfterOpenBracketBracedList``,
234-
``BreakAfterOpenBracketFunction``, ``BreakAfterOpenBracketIf``,
235-
``BreakAfterOpenBracketLoop``, ``BreakAfterOpenBracketSwitch``.
236-
in combination with ``BreakBeforeCloseBracketBracedList``,
237-
``BreakBeforeCloseBracketFunction``, ``BreakBeforeCloseBracketIf``,
238-
``BreakBeforeCloseBracketLoop``, ``BreakBeforeCloseBracketSwitch``.
239-
For backward compatibility. Do not use.
211+
.. note::
240212

213+
As of clang-format 22 this option is a bool with the previous
214+
option of ``Align`` replaced with ``true``, ``DontAlign`` replaced
215+
with ``false``, and the options of ``AlwaysBreak`` and ``BlockIndent``
216+
replaced with ``true`` and with setting of new style options using
217+
``BreakAfterOpenBracketBracedList``, ``BreakAfterOpenBracketFunction``,
218+
``BreakAfterOpenBracketIf``, ``BreakBeforeCloseBracketBracedList``,
219+
``BreakBeforeCloseBracketFunction``, and ``BreakBeforeCloseBracketIf``.
241220

221+
This applies to round brackets (parentheses), angle brackets and square
222+
brackets.
242223

243224
.. _AlignArrayOfStructures:
244225

@@ -2737,6 +2718,67 @@ the configuration (without a prefix: ``Auto``).
27372718
@Mock
27382719
DataLoad loader;
27392720
2721+
.. _BreakAfterOpenBracketBracedList:
2722+
2723+
**BreakAfterOpenBracketBracedList** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakAfterOpenBracketBracedList>`
2724+
Force break after the left bracket of a braced initializer list (when
2725+
``Cpp11BracedListStyle`` is ``true``) when the list exceeds the column
2726+
limit.
2727+
2728+
.. code-block:: c++
2729+
2730+
true: false:
2731+
vector<int> x { vs. vector<int> x {1,
2732+
1, 2, 3} 2, 3}
2733+
2734+
.. _BreakAfterOpenBracketFunction:
2735+
2736+
**BreakAfterOpenBracketFunction** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakAfterOpenBracketFunction>`
2737+
Force break after the left parenthesis of a function (declaration,
2738+
definition, call) when the parameters exceed the column limit.
2739+
2740+
.. code-block:: c++
2741+
2742+
true: false:
2743+
foo ( vs. foo (a,
2744+
a , b) b)
2745+
2746+
.. _BreakAfterOpenBracketIf:
2747+
2748+
**BreakAfterOpenBracketIf** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakAfterOpenBracketIf>`
2749+
Force break after the left parenthesis of an if control statement
2750+
when the expression exceeds the column limit.
2751+
2752+
.. code-block:: c++
2753+
2754+
true: false:
2755+
if constexpr ( vs. if constexpr (a ||
2756+
a || b) b)
2757+
2758+
.. _BreakAfterOpenBracketLoop:
2759+
2760+
**BreakAfterOpenBracketLoop** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakAfterOpenBracketLoop>`
2761+
Force break after the left parenthesis of a loop control statement
2762+
when the expression exceeds the column limit.
2763+
2764+
.. code-block:: c++
2765+
2766+
true: false:
2767+
while ( vs. while (a &&
2768+
a && b) { b) {
2769+
2770+
.. _BreakAfterOpenBracketSwitch:
2771+
2772+
**BreakAfterOpenBracketSwitch** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakAfterOpenBracketSwitch>`
2773+
Force break after the left parenthesis of a switch control statement
2774+
when the expression exceeds the column limit.
2775+
2776+
.. code-block:: c++
2777+
2778+
true: false:
2779+
switch ( vs. switch (a +
2780+
a + b) { b) {
2781+
27402782
.. _BreakAfterReturnType:
27412783

27422784
**BreakAfterReturnType** (``ReturnTypeBreakingStyle``) :versionbadge:`clang-format 19` :ref:`<BreakAfterReturnType>`
@@ -3374,6 +3416,79 @@ the configuration (without a prefix: ``Auto``).
33743416

33753417

33763418

3419+
.. _BreakBeforeCloseBracketBracedList:
3420+
3421+
**BreakBeforeCloseBracketBracedList** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakBeforeCloseBracketBracedList>`
3422+
Force break before the right bracket of a braced initializer list (when
3423+
``Cpp11BracedListStyle`` is ``true``) when the list exceeds the column
3424+
limit. The break before the right bracket is only made if there is a
3425+
break after the opening bracket.
3426+
3427+
.. code-block:: c++
3428+
3429+
true: false:
3430+
vector<int> x { vs. vector<int> x {
3431+
1, 2, 3 1, 2, 3}
3432+
}
3433+
3434+
.. _BreakBeforeCloseBracketFunction:
3435+
3436+
**BreakBeforeCloseBracketFunction** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakBeforeCloseBracketFunction>`
3437+
Force break before the right parenthesis of a function (declaration,
3438+
definition, call) when the parameters exceed the column limit.
3439+
3440+
.. code-block:: c++
3441+
3442+
true: false:
3443+
foo ( vs. foo (
3444+
a , b a , b)
3445+
)
3446+
3447+
.. _BreakBeforeCloseBracketIf:
3448+
3449+
**BreakBeforeCloseBracketIf** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakBeforeCloseBracketIf>`
3450+
Force break before the right parenthesis of an if control statement
3451+
when the expression exceeds the column limit. The break before the
3452+
closing parenthesis is only made if there is a break after the opening
3453+
parenthesis.
3454+
3455+
.. code-block:: c++
3456+
3457+
true: false:
3458+
if constexpr ( vs. if constexpr (
3459+
a || b a || b )
3460+
)
3461+
3462+
.. _BreakBeforeCloseBracketLoop:
3463+
3464+
**BreakBeforeCloseBracketLoop** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakBeforeCloseBracketLoop>`
3465+
Force break before the right parenthesis of a loop control statement
3466+
when the expression exceeds the column limit. The break before the
3467+
closing parenthesis is only made if there is a break after the opening
3468+
parenthesis.
3469+
3470+
.. code-block:: c++
3471+
3472+
true: false:
3473+
while ( vs. while (
3474+
a && b a && b) {
3475+
) {
3476+
3477+
.. _BreakBeforeCloseBracketSwitch:
3478+
3479+
**BreakBeforeCloseBracketSwitch** (``Boolean``) :versionbadge:`clang-format 22` :ref:`<BreakBeforeCloseBracketSwitch>`
3480+
Force break before the right parenthesis of a switch control statement
3481+
when the expression exceeds the column limit. The break before the
3482+
closing parenthesis is only made if there is a break after the opening
3483+
parenthesis.
3484+
3485+
.. code-block:: c++
3486+
3487+
true: false:
3488+
switch ( vs. switch (
3489+
a + b a + b) {
3490+
) {
3491+
33773492
.. _BreakBeforeConceptDeclarations:
33783493

33793494
**BreakBeforeConceptDeclarations** (``BreakBeforeConceptDeclarationsStyle``) :versionbadge:`clang-format 12` :ref:`<BreakBeforeConceptDeclarations>`

clang/lib/Format/Format.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,8 @@ template <> struct MappingTraits<FormatStyle> {
11231123
Style.BreakAfterJavaFieldAnnotations);
11241124
IO.mapOptional("BreakAfterOpenBracketBracedList",
11251125
Style.BreakAfterOpenBracketBracedList);
1126+
IO.mapOptional("BreakAfterOpenBracketFunction",
1127+
Style.BreakAfterOpenBracketFunction);
11261128
IO.mapOptional("BreakAfterOpenBracketIf", Style.BreakAfterOpenBracketIf);
11271129
IO.mapOptional("BreakAfterOpenBracketLoop",
11281130
Style.BreakAfterOpenBracketLoop);
@@ -1134,6 +1136,8 @@ template <> struct MappingTraits<FormatStyle> {
11341136
Style.BreakBeforeBinaryOperators);
11351137
IO.mapOptional("BreakBeforeCloseBracketBracedList",
11361138
Style.BreakBeforeCloseBracketBracedList);
1139+
IO.mapOptional("BreakBeforeCloseBracketFunction",
1140+
Style.BreakBeforeCloseBracketFunction);
11371141
IO.mapOptional("BreakBeforeCloseBracketIf",
11381142
Style.BreakBeforeCloseBracketIf);
11391143
IO.mapOptional("BreakBeforeCloseBracketLoop",

0 commit comments

Comments
 (0)