@@ -94,7 +94,7 @@ struct FormatStyle {
9494 // /
9595 // / \note
9696 // / This currently only applies to braced initializer lists (when
97- // / ``Cpp11BracedListStyle`` is ``true ``) and parentheses.
97+ // / ``Cpp11BracedListStyle`` is not ``Block ``) and parentheses.
9898 // / \endnote
9999 BAS_BlockIndent,
100100 };
@@ -2555,29 +2555,67 @@ struct FormatStyle {
25552555 // / \version 3.7
25562556 unsigned ContinuationIndentWidth;
25572557
2558- // / If ``true``, format braced lists as best suited for C++11 braced
2559- // / lists.
2560- // /
2561- // / Important differences:
2562- // /
2563- // / * No spaces inside the braced list.
2564- // / * No line break before the closing brace.
2565- // / * Indentation with the continuation indent, not with the block indent.
2566- // /
2567- // / Fundamentally, C++11 braced lists are formatted exactly like function
2568- // / calls would be formatted in their place. If the braced list follows a name
2569- // / (e.g. a type or variable name), clang-format formats as if the ``{}`` were
2570- // / the parentheses of a function call with that name. If there is no name,
2571- // / a zero-length name is assumed.
2572- // / \code
2573- // / true: false:
2574- // / vector<int> x{1, 2, 3, 4}; vs. vector<int> x{ 1, 2, 3, 4 };
2575- // / vector<T> x{{}, {}, {}, {}}; vector<T> x{ {}, {}, {}, {} };
2576- // / f(MyMap[{composite, key}]); f(MyMap[{ composite, key }]);
2577- // / new int[3]{1, 2, 3}; new int[3]{ 1, 2, 3 };
2578- // / \endcode
2558+ // / Different ways to handle braced lists.
2559+ enum BracedListStyle : int8_t {
2560+ // / Best suited for pre C++11 braced lists.
2561+ // /
2562+ // / * Spaces inside the braced list.
2563+ // / * Line break before the closing brace.
2564+ // / * Indentation with the block indent.
2565+ // /
2566+ // / \code
2567+ // / vector<int> x{ 1, 2, 3, 4 };
2568+ // / vector<T> x{ {}, {}, {}, {} };
2569+ // / f(MyMap[{ composite, key }]);
2570+ // / new int[3]{ 1, 2, 3 };
2571+ // / Type name{ // Comment
2572+ // / value
2573+ // / };
2574+ // / \endcode
2575+ BLS_Block,
2576+ // / Best suited for C++11 braced lists.
2577+ // /
2578+ // / * No spaces inside the braced list.
2579+ // / * No line break before the closing brace.
2580+ // / * Indentation with the continuation indent.
2581+ // /
2582+ // / Fundamentally, C++11 braced lists are formatted exactly like function
2583+ // / calls would be formatted in their place. If the braced list follows a
2584+ // / name (e.g. a type or variable name), clang-format formats as if the
2585+ // / ``{}`` were the parentheses of a function call with that name. If there
2586+ // / is no name, a zero-length name is assumed.
2587+ // / \code
2588+ // / vector<int> x{1, 2, 3, 4};
2589+ // / vector<T> x{{}, {}, {}, {}};
2590+ // / f(MyMap[{composite, key}]);
2591+ // / new int[3]{1, 2, 3};
2592+ // / Type name{ // Comment
2593+ // / value};
2594+ // / \endcode
2595+ BLS_FunctionCall,
2596+ // / Same as ``FunctionCall``, except for the handling of a comment at the
2597+ // / begin, it then aligns everything following with the comment.
2598+ // /
2599+ // / * No spaces inside the braced list. (Even for a comment at the first
2600+ // / position.)
2601+ // / * No line break before the closing brace.
2602+ // / * Indentation with the continuation indent, except when followed by a
2603+ // / line comment, then it uses the block indent.
2604+ // /
2605+ // / \code
2606+ // / vector<int> x{1, 2, 3, 4};
2607+ // / vector<T> x{{}, {}, {}, {}};
2608+ // / f(MyMap[{composite, key}]);
2609+ // / new int[3]{1, 2, 3};
2610+ // / Type name{// Comment
2611+ // / value};
2612+ // / \endcode
2613+ BLS_AlignFirstComment,
2614+ };
2615+
2616+ // / The style to handle braced lists.
25792617 // / \version 3.4
2580- bool Cpp11BracedListStyle;
2618+ BracedListStyle Cpp11BracedListStyle;
25812619
25822620 // / This option is **deprecated**. See ``DeriveLF`` and ``DeriveCRLF`` of
25832621 // / ``LineEnding``.
@@ -4933,7 +4971,7 @@ struct FormatStyle {
49334971 // / Specifies when to insert a space in empty braces.
49344972 // / \note
49354973 // / This option doesn't apply to initializer braces if
4936- // / ``Cpp11BracedListStyle`` is set to ``true ``.
4974+ // / ``Cpp11BracedListStyle`` is not ``Block ``.
49374975 // / \endnote
49384976 // / \version 22
49394977 SpaceInEmptyBracesStyle SpaceInEmptyBraces;
0 commit comments