diff options
author | Francois Ferrand <thetypz@gmail.com> | 2018-03-01 10:09:13 +0000 |
---|---|---|
committer | Francois Ferrand <thetypz@gmail.com> | 2018-03-01 10:09:13 +0000 |
commit | 2818cfe4cbfcbceed9ed0aca79c91a958636691e (patch) | |
tree | c00e8cb9067b3d10d6725b842c5756940fdfeb98 /docs/ClangFormatStyleOptions.rst | |
parent | e845f691846783e8e30d3131c8f8a08311c406e8 (diff) | |
download | clang-2818cfe4cbfcbceed9ed0aca79c91a958636691e.tar.gz |
[clang-format] Add SpaceBeforeColon option
Summary:
When disabled, this option allows removing the space before colon,
making it act more like the semi-colon. When enabled (default), the
current behavior is not affected.
This mostly affects C++11 loop, initializer list, inheritance list and
container literals:
class Foo: Bar {}
Foo::Foo(): a(a) {}
for (auto i: myList) {}
f({a: 1, b: 2, c: 3});
Reviewers: krasimir, djasper
Reviewed By: djasper
Subscribers: xvallspl, teemperor, karies, cfe-commits, klimek
Differential Revision: https://reviews.llvm.org/D32525
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326426 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/ClangFormatStyleOptions.rst')
-rw-r--r-- | docs/ClangFormatStyleOptions.rst | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/ClangFormatStyleOptions.rst b/docs/ClangFormatStyleOptions.rst index ea43f19a3c..1ddcce8b7a 100644 --- a/docs/ClangFormatStyleOptions.rst +++ b/docs/ClangFormatStyleOptions.rst @@ -1681,6 +1681,23 @@ the configuration (without a prefix: ``Auto``). int a = 5; vs. int a=5; a += 42 a+=42; +**SpaceBeforeCtorInitializerColon** (``bool``) + If ``false``, spaces will be removed before constructor initializer + colon. + + .. code-block:: c++ + + true: false: + Foo::Foo() : a(a) {} Foo::Foo(): a(a) {} + +**SpaceBeforeInheritanceColon** (``bool``) + If ``false``, spaces will be removed before inheritance colon. + + .. code-block:: c++ + + true: false: + class Foo : Bar {} vs. class Foo: Bar {} + **SpaceBeforeParens** (``SpaceBeforeParensOptions``) Defines in which cases to put a space before opening parentheses. @@ -1725,6 +1742,15 @@ the configuration (without a prefix: ``Auto``). +**SpaceBeforeRangeBasedForLoopColon** (``bool``) + If ``false``, spaces will be removed before range-based for loop + colon. + + .. code-block:: c++ + + true: false: + for (auto v : values) {} vs. for(auto v: values) {} + **SpaceInEmptyParentheses** (``bool``) If ``true``, spaces may be inserted into ``()``. |