summaryrefslogtreecommitdiffstats
path: root/clang/docs
diff options
context:
space:
mode:
Diffstat (limited to 'clang/docs')
-rw-r--r--clang/docs/ClangFormatStyleOptions.rst49
-rwxr-xr-xclang/docs/tools/dump_format_style.py10
2 files changed, 41 insertions, 18 deletions
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 727e60488f0..fd14d90ff53 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -155,21 +155,29 @@ the configuration (without a prefix: ``Auto``).
This applies to round brackets (parentheses), angle brackets and square
brackets. This will result in formattings like
- \code
- someLongFunction(argument1,
- argument2);
- \endcode
+ .. code-block:: c++
+ someLongFunction(argument1,
+ argument2);
**AlignConsecutiveAssignments** (``bool``)
If ``true``, aligns consecutive assignments.
This will align the assignment operators of consecutive lines. This
will result in formattings like
- \code
- int aaaa = 12;
- int b = 23;
- int ccc = 23;
- \endcode
+ .. code-block:: c++
+ int aaaa = 12;
+ int b = 23;
+ int ccc = 23;
+
+**AlignConsecutiveDeclarations** (``bool``)
+ If ``true``, aligns consecutive declarations.
+
+ This will align the declaration names of consecutive lines. This
+ will result in formattings like
+ .. code-block:: c++
+ int aaaa = 12;
+ float b = 23;
+ std::string ccc = 23;
**AlignEscapedNewlinesLeft** (``bool``)
If ``true``, aligns escaped newlines as far left as possible.
@@ -381,14 +389,17 @@ the configuration (without a prefix: ``Auto``).
instead of as function calls.
These are expected to be macros of the form:
- \code
- FOREACH(<variable-declaration>, ...)
- <loop-body>
- \endcode
+ .. code-block:: c++
+ FOREACH(<variable-declaration>, ...)
+ <loop-body>
+
+ In the .clang-format configuration file, this can be configured like:
+ .. code-block:: c++
+ ForEachMacros: ['RANGES_FOR', 'FOREACH']
For example: BOOST_FOREACH.
-**IncludeCategories** (``std::vector<std::pair<std::string, unsigned>>``)
+**IncludeCategories** (``std::vector<IncludeCategory>``)
Regular expressions denoting the different #include categories used
for ordering #includes.
@@ -403,6 +414,16 @@ the configuration (without a prefix: ``Auto``).
so that it is kept at the beginning of the #includes
(http://llvm.org/docs/CodingStandards.html#include-style).
+ To configure this in the .clang-format file, use:
+ .. code-block:: c++
+ IncludeCategories:
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 2
+ - Regex: '^(<|"(gtest|isl|json)/)'
+ Priority: 3
+ - Regex: '.\*'
+ Priority: 1
+
**IndentCaseLabels** (``bool``)
Indent case labels one level from the switch statement.
diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py
index 308f47fb0cb..8d1323e8a1a 100755
--- a/clang/docs/tools/dump_format_style.py
+++ b/clang/docs/tools/dump_format_style.py
@@ -86,7 +86,11 @@ class EnumValue:
doxygen2rst(indent(self.comment, 2)))
def clean_comment_line(line):
- return line[3:].strip() + '\n'
+ if line == '/// \\code':
+ return '.. code-block:: c++\n'
+ if line == '/// \\endcode':
+ return ''
+ return line[4:] + '\n'
def read_options(header):
class State:
@@ -139,8 +143,6 @@ def read_options(header):
elif line == '};':
state = State.InStruct
nested_structs[nested_struct.name] = nested_struct
- else:
- raise Exception('Invalid format, expected struct field comment or };')
elif state == State.InNestedFieldComent:
if line.startswith('///'):
comment += clean_comment_line(line)
@@ -168,7 +170,7 @@ def read_options(header):
for option in options:
if not option.type in ['bool', 'unsigned', 'int', 'std::string',
'std::vector<std::string>',
- 'std::vector<std::pair<std::string, unsigned>>']:
+ 'std::vector<IncludeCategory>']:
if enums.has_key(option.type):
option.enum = enums[option.type]
elif nested_structs.has_key(option.type):
OpenPOWER on IntegriCloud