diff options
author | Ronald Wampler <rdwampler@gmail.com> | 2019-03-26 20:18:14 +0000 |
---|---|---|
committer | Ronald Wampler <rdwampler@gmail.com> | 2019-03-26 20:18:14 +0000 |
commit | 7e997c278b6a5b1e2e39c7242dd854b3d10b58ee (patch) | |
tree | f5d2d9b780088f6a7dabcc422a4324622fef9f7a /docs/ClangFormatStyleOptions.rst | |
parent | 182d7fa38b05c20dea18a8d5c922710b2f0b7875 (diff) | |
download | clang-7e997c278b6a5b1e2e39c7242dd854b3d10b58ee.tar.gz |
[clang-format] Add style option AllowShortLambdasOnASingleLine
Summary:
This option `AllowShortLambdasOnASingleLine` similar to the other `AllowShort*` options, but applied to C++ lambdas.
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: MyDeveloperDay, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57687
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/ClangFormatStyleOptions.rst')
-rw-r--r-- | docs/ClangFormatStyleOptions.rst | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/ClangFormatStyleOptions.rst b/docs/ClangFormatStyleOptions.rst index 0ddc313d27..0614af3634 100644 --- a/docs/ClangFormatStyleOptions.rst +++ b/docs/ClangFormatStyleOptions.rst @@ -449,6 +449,45 @@ the configuration (without a prefix: ``Auto``). return; } +**AllowShortLambdasOnASingleLine** (``ShortLambdaStyle``) + Dependent on the value, ``auto lambda []() { return 0; }`` can be put on a + single line. + + Possible values: + + * ``SLS_None`` (in configuration: ``None``) + Never merge lambdas into a single line. + + * ``SLS_Empty`` (in configuration: ``Empty``) + Only merge empty lambdas. + + .. code-block:: c++ + + auto lambda = [](int a) {} + auto lambda2 = [](int a) { + return a; + }; + + * ``SLS_Inline`` (in configuration: ``Inline``) + Merge lambda into a single line if argument of a function. + + .. code-block:: c++ + + auto lambda = [](int a) { + return a; + }; + sort(a.begin(), a.end(), ()[] { return x < y; }) + + * ``SLS_All`` (in configuration: ``All``) + Merge all lambdas fitting on a single line. + + .. code-block:: c++ + + auto lambda = [](int a) {} + auto lambda2 = [](int a) { return a; }; + + + **AllowShortLoopsOnASingleLine** (``bool``) If ``true``, ``while (true) continue;`` can be put on a single line. |