@@ -62,21 +62,86 @@ struct FormatStyle {
62
62
// / \version 3.3
63
63
int AccessModifierOffset;
64
64
65
- // / Different styles for breaking the parenthesis after a control statement
66
- // / (``if/switch/while/for ...``).
65
+ // / Different styles for breaking the parenthesis after ``if/else if``.
67
66
// / \version 21
68
- enum BreakAfterControlStatementStyle : int8_t {
69
- // / Use the default behavior.
70
- BACSS_Default,
71
- // / Force break after the left parenthesis of a control statement only
72
- // / when the expression exceeds the column limit, and align on the
73
- // / ``ContinuationIndentWidth``.
74
- BACSS_MultiLine,
75
- // / Do not force a break after the control statment.
76
- BACSS_No,
67
+ enum BreakAfterOpenBracketIfStyle : int8_t {
68
+ // / Always break the opening parenthesis of an if statement, e.g.:
69
+ // / \code
70
+ // / if constexpr (
71
+ // / a)
72
+ // / \endcode
73
+ BAOBIS_Always,
74
+ // / Force break after the left parenthesis of an if statement only
75
+ // / when the expression exceeds the column limit, e.g..:
76
+ // / \code
77
+ // / if constexpr (
78
+ // / a ||
79
+ // / b)
80
+ // / \endcode
81
+ BAOBIS_MultiLine,
82
+ // / Do not force a break after the control statement.
83
+ // / \code
84
+ // / if constexpr (a ||
85
+ // / b
86
+ // / \endcode
87
+ BAOBIS_No,
88
+ };
89
+
90
+ BreakAfterOpenBracketIfStyle BreakAfterOpenBracketIf;
91
+
92
+ // / Different styles for breaking the parenthesis after loops ``(for/while)``.
93
+ // / \version 21
94
+ enum BreakAfterOpenBracketLoopStyle : int8_t {
95
+ // / Always break the opening parenthesis of a loop statement, e.g.:
96
+ // / \code
97
+ // / while (
98
+ // / a) {
99
+ // / \endcode
100
+ BAOBLS_Always,
101
+ // / Force break after the left parenthesis of a loop only
102
+ // / when the expression exceeds the column limit, e.g..:
103
+ // / \code
104
+ // / while (
105
+ // / a &&
106
+ // / b) {
107
+ // / \endcode
108
+ BAOBLS_MultiLine,
109
+ // / Do not force a break after the control statement.
110
+ // / \code
111
+ // / while (a &&
112
+ // / b) {
113
+ // / \endcode
114
+ BAOBLS_No,
115
+ };
116
+
117
+ BreakAfterOpenBracketLoopStyle BreakAfterOpenBracketLoop;
118
+
119
+ // / Different styles for breaking the parenthesis after ``switch``.
120
+ // / \version 21
121
+ enum BreakAfterOpenBracketSwitchStyle : int8_t {
122
+ // / Always break the opening parenthesis of a switch statement, e.g.:
123
+ // / \code
124
+ // / switch (
125
+ // / a) {
126
+ // / \endcode
127
+ BAOBSS_Always,
128
+ // / Force break after the left parenthesis of a switch only
129
+ // / when the expression exceeds the column limit, e.g..:
130
+ // / \code
131
+ // / switch (
132
+ // / a &&
133
+ // / b) {
134
+ // / \endcode
135
+ BAOBSS_MultiLine,
136
+ // / Do not force a break after the control statement.
137
+ // / \code
138
+ // / switch (a &&
139
+ // / b) {
140
+ // / \endcode
141
+ BAOBSS_No,
77
142
};
78
143
79
- BreakAfterControlStatementStyle AlignAfterControlStatement ;
144
+ BreakAfterOpenBracketSwitchStyle BreakAfterOpenBracketSwitch ;
80
145
81
146
// / Different styles for aligning after open brackets.
82
147
enum BracketAlignmentStyle : int8_t {
@@ -2231,6 +2296,88 @@ struct FormatStyle {
2231
2296
// / \version 3.7
2232
2297
BraceBreakingStyle BreakBeforeBraces;
2233
2298
2299
+ // / Different styles for breaking before ``if/else if`` closing parenthesis.
2300
+ // / \version 21
2301
+ enum BreakBeforeCloseBracketIfStyle : int8_t {
2302
+ // / Always break the closing parenthesis of an if statement, e.g.:
2303
+ // / \code
2304
+ // / if constexpr (a
2305
+ // / )
2306
+ // / \endcode
2307
+ BBCBIS_Always,
2308
+ // / Force break before the closing parenthesis of an if statement only
2309
+ // / when the expression exceeds the column limit, e.g..:
2310
+ // / \code
2311
+ // / if constexpr (a ||
2312
+ // / b
2313
+ // / )
2314
+ // / \endcode
2315
+ BBCBIS_MultiLine,
2316
+ // / Do not force a break before closing the if control statement.
2317
+ // / \code
2318
+ // / if constexpr (a ||
2319
+ // / b)
2320
+ // / \endcode
2321
+ BBCBIS_No,
2322
+ };
2323
+
2324
+ BreakBeforeCloseBracketIfStyle BreakBeforeCloseBracketIf;
2325
+
2326
+ // / Different styles for breaking before loop ``(for/while)`` closing
2327
+ // / parenthesis.
2328
+ // / \version 21
2329
+ enum BreakBeforeCloseBracketLoopStyle : int8_t {
2330
+ // / Always break the closing parenthesis of a loop statement, e.g.:
2331
+ // / \code
2332
+ // / while (a
2333
+ // / ) {
2334
+ // / \endcode
2335
+ BBCBLS_Always,
2336
+ // / Force break before the closing parenthesis of a loop only
2337
+ // / when the expression exceeds the column limit, e.g..:
2338
+ // / \code
2339
+ // / while (a &&
2340
+ // / b
2341
+ // / ) {
2342
+ // / \endcode
2343
+ BBCBLS_MultiLine,
2344
+ // / Do not force a break before closing the loop control statement.
2345
+ // / \code
2346
+ // / while (a &&
2347
+ // / b) {
2348
+ // / \endcode
2349
+ BBCBLS_No,
2350
+ };
2351
+
2352
+ BreakBeforeCloseBracketLoopStyle BreakBeforeCloseBracketLoop;
2353
+
2354
+ // / Different styles for breaking before ``switch`` closing parenthesis.
2355
+ // / \version 21
2356
+ enum BreakBeforeCloseBracketSwitchStyle : int8_t {
2357
+ // / Always break before the closing parenthesis of a switch statement, e.g.:
2358
+ // / \code
2359
+ // / switch (a
2360
+ // / ) {
2361
+ // / \endcode
2362
+ BBCBSS_Always,
2363
+ // / Force break before the closing parenthesis of a switch only
2364
+ // / when the expression exceeds the column limit, e.g..:
2365
+ // / \code
2366
+ // / switch (a &&
2367
+ // / b
2368
+ // / ) {
2369
+ // / \endcode
2370
+ BBCBSS_MultiLine,
2371
+ // / Do not force a break before closing the switch control statement.
2372
+ // / \code
2373
+ // / switch (a &&
2374
+ // / b) {
2375
+ // / \endcode
2376
+ BBCBSS_No,
2377
+ };
2378
+
2379
+ BreakBeforeCloseBracketSwitchStyle BreakBeforeCloseBracketSwitch;
2380
+
2234
2381
// / Different ways to break before concept declarations.
2235
2382
enum BreakBeforeConceptDeclarationsStyle : int8_t {
2236
2383
// / Keep the template declaration line together with ``concept``.
@@ -5321,7 +5468,6 @@ struct FormatStyle {
5321
5468
5322
5469
bool operator ==(const FormatStyle &R) const {
5323
5470
return AccessModifierOffset == R.AccessModifierOffset &&
5324
- AlignAfterControlStatement == R.AlignAfterControlStatement &&
5325
5471
AlignAfterOpenBracket == R.AlignAfterOpenBracket &&
5326
5472
AlignArrayOfStructures == R.AlignArrayOfStructures &&
5327
5473
AlignConsecutiveAssignments == R.AlignConsecutiveAssignments &&
@@ -5371,10 +5517,16 @@ struct FormatStyle {
5371
5517
BreakAdjacentStringLiterals == R.BreakAdjacentStringLiterals &&
5372
5518
BreakAfterAttributes == R.BreakAfterAttributes &&
5373
5519
BreakAfterJavaFieldAnnotations == R.BreakAfterJavaFieldAnnotations &&
5520
+ BreakAfterOpenBracketIf == R.BreakAfterOpenBracketIf &&
5521
+ BreakAfterOpenBracketLoop == R.BreakAfterOpenBracketLoop &&
5522
+ BreakAfterOpenBracketSwitch == R.BreakAfterOpenBracketSwitch &&
5374
5523
BreakAfterReturnType == R.BreakAfterReturnType &&
5375
5524
BreakArrays == R.BreakArrays &&
5376
5525
BreakBeforeBinaryOperators == R.BreakBeforeBinaryOperators &&
5377
5526
BreakBeforeBraces == R.BreakBeforeBraces &&
5527
+ BreakBeforeCloseBracketIf == R.BreakBeforeCloseBracketIf &&
5528
+ BreakBeforeCloseBracketLoop == R.BreakBeforeCloseBracketLoop &&
5529
+ BreakBeforeCloseBracketSwitch == R.BreakBeforeCloseBracketSwitch &&
5378
5530
BreakBeforeConceptDeclarations == R.BreakBeforeConceptDeclarations &&
5379
5531
BreakBeforeInlineASMColon == R.BreakBeforeInlineASMColon &&
5380
5532
BreakBeforeTemplateCloser == R.BreakBeforeTemplateCloser &&
0 commit comments