diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -2312,8 +2312,8 @@ **SpacesInSquareBrackets** (``bool``) If ``true``, spaces will be inserted after ``[`` and before ``]``. - Lambdas without arguments or unspecified size array declarations will not be - affected. + Lambdas without arguments or unspecified size array declarations will not + be affected. .. code-block:: c++ @@ -2332,29 +2332,29 @@ Possible values: * ``LS_Cpp03`` (in configuration: ``c++03``) - Use C++03-compatible syntax. + Parse and format as C++03. + ``Cpp03`` is a deprecated alias for ``c++03`` * ``LS_Cpp11`` (in configuration: ``c++11``) - Use C++11-compatible syntax. + Parse and format as C++11. * ``LS_Cpp14`` (in configuration: ``c++14``) - Use C++14-compatible syntax. + Parse and format as C++14. * ``LS_Cpp17`` (in configuration: ``c++17``) - Use C++17-compatible syntax. + Parse and format as C++17. * ``LS_Cpp20`` (in configuration: ``c++20``) - Use C++20-compatible syntax. + Parse and format as C++20. * ``LS_Latest`` (in configuration: ``Latest``) Parse and format using the latest supported language version. + ``Cpp11`` is a deprecated alias for ``Latest`` * ``LS_Auto`` (in configuration: ``Auto``) Automatic detection based on the input. - * ``Cpp03``: deprecated alias for ``c++03`` - * ``Cpp11``: deprecated alias for ``Latest`` **StatementMacros** (``std::vector``) A vector of macros that should be interpreted as complete diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py --- a/clang/docs/tools/dump_format_style.py +++ b/clang/docs/tools/dump_format_style.py @@ -78,14 +78,15 @@ return '\n'.join(map(str, self.values)) class EnumValue(object): - def __init__(self, name, comment): + def __init__(self, name, comment, config): self.name = name self.comment = comment + self.config = config def __str__(self): return '* ``%s`` (in configuration: ``%s``)\n%s' % ( self.name, - re.sub('.*_', '', self.name), + re.sub('.*_', '', self.config), doxygen2rst(indent(self.comment, 2))) def clean_comment_line(line): @@ -170,7 +171,14 @@ comment += clean_comment_line(line) else: state = State.InEnum - enum.values.append(EnumValue(line.replace(',', ''), comment)) + val = line.replace(',', '') + pos = val.find(" // ") + if (pos != -1): + config = val[pos+4:] + val = val[:pos] + else: + config = val; + enum.values.append(EnumValue(val, comment,config)) if state != State.Finished: raise Exception('Not finished by the end of file') diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -708,7 +708,7 @@ BS_Allman, /// Like ``Allman`` but always indent braces and line up code with braces. /// \code - /// try + /// try /// { /// foo(); /// } @@ -850,6 +850,7 @@ /// {}; /// \endcode bool AfterClass; + /// Wrap control statements (``if``/``for``/``while``/``switch``/..). BraceWrappingAfterControlStatementStyle AfterControlStatement; /// Wrap enum definitions. @@ -1965,7 +1966,8 @@ bool SpacesInParentheses; /// If ``true``, spaces will be inserted after ``[`` and before ``]``. - /// Lambdas or unspecified size array declarations will not be affected. + /// Lambdas without arguments or unspecified size array declarations will not + /// be affected. /// \code /// true: false: /// int a[ 5 ]; vs. int a[5]; @@ -1982,26 +1984,29 @@ /// The correct way to spell a specific language version is e.g. ``c++11``. /// The historical aliases ``Cpp03`` and ``Cpp11`` are deprecated. enum LanguageStandard { - /// c++03: Parse and format as C++03. - LS_Cpp03, - /// c++11: Parse and format as C++11. - LS_Cpp11, - /// c++14: Parse and format as C++14. - LS_Cpp14, - /// c++17: Parse and format as C++17. - LS_Cpp17, - /// c++20: Parse and format as C++20. - LS_Cpp20, - /// Latest: Parse and format using the latest supported language version. - /// 'Cpp11' is an alias for LS_Latest for historical reasons. + /// Parse and format as C++03. + /// ``Cpp03`` is a deprecated alias for ``c++03`` + LS_Cpp03, // c++03 + /// Parse and format as C++11. + LS_Cpp11, // c++11 + /// Parse and format as C++14. + LS_Cpp14, // c++14 + /// Parse and format as C++17. + LS_Cpp17, // c++17 + /// Parse and format as C++20. + LS_Cpp20, // c++20 + /// Parse and format using the latest supported language version. + /// ``Cpp11`` is a deprecated alias for ``Latest`` LS_Latest, - /// Auto: Automatic detection based on the input. - /// Parse using the latest language version. Format based on detected input. + /// Automatic detection based on the input. LS_Auto, }; - /// Format compatible with this standard, e.g. use ``A >`` - /// instead of ``A>`` for ``LS_Cpp03``. + /// Parse and format C++ constructs compatible with this standard. + /// \code + /// c++03: latest: + /// vector > x; vs. vector> x; + /// \endcode LanguageStandard Standard; /// The number of columns used for tab stops.