diff options
author | Francois Ferrand <thetypz@gmail.com> | 2018-06-11 14:41:26 +0000 |
---|---|---|
committer | Francois Ferrand <thetypz@gmail.com> | 2018-06-11 14:41:26 +0000 |
commit | 6bb103f9facf48253b3a29c37d8870e7abaa7ff5 (patch) | |
tree | 50f10c5216e474a55ddbd1b6cb6d51ba477856ef /clang/docs/ClangFormatStyleOptions.rst | |
parent | 7db69cc08aef49192ea86d4fc0fe7210ad2b5e50 (diff) | |
download | bcm5719-llvm-6bb103f9facf48253b3a29c37d8870e7abaa7ff5.tar.gz bcm5719-llvm-6bb103f9facf48253b3a29c37d8870e7abaa7ff5.zip |
clang-format: Introduce BreakInheritanceList option
Summary:
This option replaces the BreakBeforeInheritanceComma option with an
enum, thus introducing a mode where the colon stays on the same line as
constructor declaration:
// When it fits on line:
class A : public B, public C {
...
};
// When it does not fit:
class A :
public B,
public C {
...
};
This matches the behavior of the `BreakConstructorInitializers` option,
introduced in https://reviews.llvm.org/D32479.
Reviewers: djasper, klimek
Reviewed By: djasper
Subscribers: mzeren-vmw, cfe-commits
Differential Revision: https://reviews.llvm.org/D43015
llvm-svn: 334408
Diffstat (limited to 'clang/docs/ClangFormatStyleOptions.rst')
-rw-r--r-- | clang/docs/ClangFormatStyleOptions.rst | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 487660a6ee5..24ce4fba775 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -994,18 +994,6 @@ the configuration (without a prefix: ``Auto``). -**BreakBeforeInheritanceComma** (``bool``) - If ``true``, in the class inheritance expression clang-format will - break before ``:`` and ``,`` if there is multiple inheritance. - - .. code-block:: c++ - - true: false: - class MyClass vs. class MyClass : public X, public Y { - : public X }; - , public Y { - }; - **BreakBeforeTernaryOperators** (``bool``) If ``true``, ternary operators will be placed after line breaks. @@ -1056,6 +1044,42 @@ the configuration (without a prefix: ``Auto``). +**BreakInheritanceList** (``BreakInheritanceListStyle``) + The inheritance list style to use. + + Possible values: + + * ``BILS_BeforeColon`` (in configuration: ``BeforeColon``) + Break inheritance list before the colon and after the commas. + + .. code-block:: c++ + + class Foo + : Base1, + Base2 + {}; + + * ``BILS_BeforeComma`` (in configuration: ``BeforeComma``) + Break inheritance list before the colon and commas, and align + the commas with the colon. + + .. code-block:: c++ + + Constructor() + : initializer1() + , initializer2() + + * ``BILS_AfterColon`` (in configuration: ``AfterColon``) + Break inheritance list after the colon and commas. + + .. code-block:: c++ + + Constructor() : + initializer1(), + initializer2() + + + **BreakStringLiterals** (``bool``) Allow breaking string literals when formatting. @@ -1122,7 +1146,7 @@ the configuration (without a prefix: ``Auto``). **ConstructorInitializerIndentWidth** (``unsigned``) The number of characters to use for indentation of constructor - initializer lists. + initializer lists as well as inheritance lists. **ContinuationIndentWidth** (``unsigned``) Indent width for line continuations. |