@@ -62,49 +62,28 @@ struct FormatStyle {
6262 // / \version 3.3
6363 int AccessModifierOffset;
6464
65- // / Different styles for aligning after open brackets.
66- enum BracketAlignmentStyle : int8_t {
67- // / Align parameters on the open bracket, e.g.:
68- // / \code
69- // / someLongFunction(argument1,
70- // / argument2);
71- // / \endcode
72- BAS_Align,
73- // / Don't align, instead use ``ContinuationIndentWidth``, e.g.:
74- // / \code
75- // / someLongFunction(argument1,
76- // / argument2);
77- // / \endcode
78- BAS_DontAlign,
79- // / Always break after an open bracket, if the parameters don't fit
80- // / on a single line, e.g.:
81- // / \code
82- // / someLongFunction(
83- // / argument1, argument2);
84- // / \endcode
85- BAS_AlwaysBreak,
86- // / Always break after an open bracket, if the parameters don't fit
87- // / on a single line. Closing brackets will be placed on a new line.
88- // / E.g.:
89- // / \code
90- // / someLongFunction(
91- // / argument1, argument2
92- // / )
93- // / \endcode
94- // /
95- // / \note
96- // / This currently only applies to braced initializer lists (when
97- // / ``Cpp11BracedListStyle`` is not ``Block``) and parentheses.
98- // / \endnote
99- BAS_BlockIndent,
100- };
101-
10265 // / If ``true``, horizontally aligns arguments after an open bracket.
10366 // /
67+ // / \code
68+ // / true: vs. false
69+ // / someLongFunction(argument1, someLongFunction(argument1,
70+ // / argument2); argument2);
71+ // / \endcode
72+ // /
73+ // / \note
74+ // / As of clang-format 22 this option is a bool with the previous
75+ // / option of ``Align`` replaced with ``true``, ``DontAlign`` replaced
76+ // / with ``false``, and the options of ``AlwaysBreak`` and ``BlockIndent``
77+ // / replaced with ``true`` and with setting of new style options using
78+ // / ``BreakAfterOpenBracketBracedList``, ``BreakAfterOpenBracketFunction``,
79+ // / ``BreakAfterOpenBracketIf``, ``BreakBeforeCloseBracketBracedList``,
80+ // / ``BreakBeforeCloseBracketFunction``, and ``BreakBeforeCloseBracketIf``.
81+ // / \endnote
82+ // /
10483 // / This applies to round brackets (parentheses), angle brackets and square
10584 // / brackets.
10685 // / \version 3.8
107- BracketAlignmentStyle AlignAfterOpenBracket;
86+ bool AlignAfterOpenBracket;
10887
10988 // / Different style for aligning array initializers.
11089 enum ArrayInitializerAlignmentStyle : int8_t {
@@ -1708,6 +1687,57 @@ struct FormatStyle {
17081687 // / \version 16
17091688 AttributeBreakingStyle BreakAfterAttributes;
17101689
1690+ // / Force break after the left bracket of a braced initializer list (when
1691+ // / ``Cpp11BracedListStyle`` is ``true``) when the list exceeds the column
1692+ // / limit.
1693+ // / \code
1694+ // / true: false:
1695+ // / vector<int> x { vs. vector<int> x {1,
1696+ // / 1, 2, 3} 2, 3}
1697+ // / \endcode
1698+ // / \version 22
1699+ bool BreakAfterOpenBracketBracedList;
1700+
1701+ // / Force break after the left parenthesis of a function (declaration,
1702+ // / definition, call) when the parameters exceed the column limit.
1703+ // / \code
1704+ // / true: false:
1705+ // / foo ( vs. foo (a,
1706+ // / a , b) b)
1707+ // / \endcode
1708+ // / \version 22
1709+ bool BreakAfterOpenBracketFunction;
1710+
1711+ // / Force break after the left parenthesis of an if control statement
1712+ // / when the expression exceeds the column limit.
1713+ // / \code
1714+ // / true: false:
1715+ // / if constexpr ( vs. if constexpr (a ||
1716+ // / a || b) b)
1717+ // / \endcode
1718+ // / \version 22
1719+ bool BreakAfterOpenBracketIf;
1720+
1721+ // / Force break after the left parenthesis of a loop control statement
1722+ // / when the expression exceeds the column limit.
1723+ // / \code
1724+ // / true: false:
1725+ // / while ( vs. while (a &&
1726+ // / a && b) { b) {
1727+ // / \endcode
1728+ // / \version 22
1729+ bool BreakAfterOpenBracketLoop;
1730+
1731+ // / Force break after the left parenthesis of a switch control statement
1732+ // / when the expression exceeds the column limit.
1733+ // / \code
1734+ // / true: false:
1735+ // / switch ( vs. switch (a +
1736+ // / a + b) { b) {
1737+ // / \endcode
1738+ // / \version 22
1739+ bool BreakAfterOpenBracketSwitch;
1740+
17111741 // / The function declaration return type breaking style to use.
17121742 // / \version 19
17131743 ReturnTypeBreakingStyle BreakAfterReturnType;
@@ -2221,6 +2251,69 @@ struct FormatStyle {
22212251 // / \version 3.7
22222252 BraceBreakingStyle BreakBeforeBraces;
22232253
2254+ // / Force break before the right bracket of a braced initializer list (when
2255+ // / ``Cpp11BracedListStyle`` is ``true``) when the list exceeds the column
2256+ // / limit. The break before the right bracket is only made if there is a
2257+ // / break after the opening bracket.
2258+ // / \code
2259+ // / true: false:
2260+ // / vector<int> x { vs. vector<int> x {
2261+ // / 1, 2, 3 1, 2, 3}
2262+ // / }
2263+ // / \endcode
2264+ // / \version 22
2265+ bool BreakBeforeCloseBracketBracedList;
2266+
2267+ // / Force break before the right parenthesis of a function (declaration,
2268+ // / definition, call) when the parameters exceed the column limit.
2269+ // / \code
2270+ // / true: false:
2271+ // / foo ( vs. foo (
2272+ // / a , b a , b)
2273+ // / )
2274+ // / \endcode
2275+ // / \version 22
2276+ bool BreakBeforeCloseBracketFunction;
2277+
2278+ // / Force break before the right parenthesis of an if control statement
2279+ // / when the expression exceeds the column limit. The break before the
2280+ // / closing parenthesis is only made if there is a break after the opening
2281+ // / parenthesis.
2282+ // / \code
2283+ // / true: false:
2284+ // / if constexpr ( vs. if constexpr (
2285+ // / a || b a || b )
2286+ // / )
2287+ // / \endcode
2288+ // / \version 22
2289+ bool BreakBeforeCloseBracketIf;
2290+
2291+ // / Force break before the right parenthesis of a loop control statement
2292+ // / when the expression exceeds the column limit. The break before the
2293+ // / closing parenthesis is only made if there is a break after the opening
2294+ // / parenthesis.
2295+ // / \code
2296+ // / true: false:
2297+ // / while ( vs. while (
2298+ // / a && b a && b) {
2299+ // / ) {
2300+ // / \endcode
2301+ // / \version 22
2302+ bool BreakBeforeCloseBracketLoop;
2303+
2304+ // / Force break before the right parenthesis of a switch control statement
2305+ // / when the expression exceeds the column limit. The break before the
2306+ // / closing parenthesis is only made if there is a break after the opening
2307+ // / parenthesis.
2308+ // / \code
2309+ // / true: false:
2310+ // / switch ( vs. switch (
2311+ // / a + b a + b) {
2312+ // / ) {
2313+ // / \endcode
2314+ // / \version 22
2315+ bool BreakBeforeCloseBracketSwitch;
2316+
22242317 // / Different ways to break before concept declarations.
22252318 enum BreakBeforeConceptDeclarationsStyle : int8_t {
22262319 // / Keep the template declaration line together with ``concept``.
@@ -5530,10 +5623,23 @@ struct FormatStyle {
55305623 BreakAdjacentStringLiterals == R.BreakAdjacentStringLiterals &&
55315624 BreakAfterAttributes == R.BreakAfterAttributes &&
55325625 BreakAfterJavaFieldAnnotations == R.BreakAfterJavaFieldAnnotations &&
5626+ BreakAfterOpenBracketBracedList ==
5627+ R.BreakAfterOpenBracketBracedList &&
5628+ BreakAfterOpenBracketFunction == R.BreakAfterOpenBracketFunction &&
5629+ BreakAfterOpenBracketIf == R.BreakAfterOpenBracketIf &&
5630+ BreakAfterOpenBracketLoop == R.BreakAfterOpenBracketLoop &&
5631+ BreakAfterOpenBracketSwitch == R.BreakAfterOpenBracketSwitch &&
55335632 BreakAfterReturnType == R.BreakAfterReturnType &&
55345633 BreakArrays == R.BreakArrays &&
55355634 BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators &&
55365635 BreakBeforeBraces == R.BreakBeforeBraces &&
5636+ BreakBeforeCloseBracketBracedList ==
5637+ R.BreakBeforeCloseBracketBracedList &&
5638+ BreakBeforeCloseBracketFunction ==
5639+ R.BreakBeforeCloseBracketFunction &&
5640+ BreakBeforeCloseBracketIf == R.BreakBeforeCloseBracketIf &&
5641+ BreakBeforeCloseBracketLoop == R.BreakBeforeCloseBracketLoop &&
5642+ BreakBeforeCloseBracketSwitch == R.BreakBeforeCloseBracketSwitch &&
55375643 BreakBeforeConceptDeclarations == R.BreakBeforeConceptDeclarations &&
55385644 BreakBeforeInlineASMColon == R.BreakBeforeInlineASMColon &&
55395645 BreakBeforeTemplateCloser == R.BreakBeforeTemplateCloser &&
0 commit comments