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