summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/docs/ClangFormatStyleOptions.rst18
-rwxr-xr-xclang/docs/tools/dump_format_style.py14
-rw-r--r--clang/include/clang/Format/Format.h41
3 files changed, 43 insertions, 30 deletions
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index cadb6d4f491..1f915c34688 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -2312,8 +2312,8 @@ the configuration (without a prefix: ``Auto``).
**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 @@ the configuration (without a prefix: ``Auto``).
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<std::string>``)
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
index 5feb793a4d7..db65e6e65b1 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -78,14 +78,15 @@ class Enum(object):
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 @@ def read_options(header):
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
index b38d1f7d940..70e82de2884 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -708,7 +708,7 @@ struct FormatStyle {
BS_Allman,
/// Like ``Allman`` but always indent braces and line up code with braces.
/// \code
- /// try
+ /// try
/// {
/// foo();
/// }
@@ -850,6 +850,7 @@ struct FormatStyle {
/// {};
/// \endcode
bool AfterClass;
+
/// Wrap control statements (``if``/``for``/``while``/``switch``/..).
BraceWrappingAfterControlStatementStyle AfterControlStatement;
/// Wrap enum definitions.
@@ -1965,7 +1966,8 @@ struct FormatStyle {
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 @@ struct FormatStyle {
/// 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<A<int> >``
- /// instead of ``A<A<int>>`` for ``LS_Cpp03``.
+ /// Parse and format C++ constructs compatible with this standard.
+ /// \code
+ /// c++03: latest:
+ /// vector<set<int> > x; vs. vector<set<int>> x;
+ /// \endcode
LanguageStandard Standard;
/// The number of columns used for tab stops.
OpenPOWER on IntegriCloud