[clang] 7b36538 - [clang-format] make doc for SLS_Inline more clearly
via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 15 05:09:00 PST 2022
Author: Backl1ght
Date: 2022-12-15T20:51:53+08:00
New Revision: 7b36538156b7742627b422c0e6a3a18ec13b99b3
URL: https://github.com/llvm/llvm-project/commit/7b36538156b7742627b422c0e6a3a18ec13b99b3
DIFF: https://github.com/llvm/llvm-project/commit/7b36538156b7742627b422c0e6a3a18ec13b99b3.diff
LOG: [clang-format] make doc for SLS_Inline more clearly
Reviewed By: HazardyKnusperkeks, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D139937
Added:
Modified:
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h
Removed:
################################################################################
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 76ae54b6ef6da..969fce82781c2 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -1191,14 +1191,14 @@ the configuration (without a prefix: ``Auto``).
};
* ``SLS_Inline`` (in configuration: ``Inline``)
- Merge lambda into a single line if argument of a function.
+ Merge lambda into a single line if the lambda is argument of a function.
.. code-block:: c++
- auto lambda = [](int a) {
- return a;
+ auto lambda = [](int x, int y) {
+ return x < y;
};
- sort(a.begin(), a.end(), []() { return x < y; });
+ sort(a.begin(), a.end(), [](int x, int y) { return x < y; });
* ``SLS_All`` (in configuration: ``All``)
Merge all lambdas fitting on a single line.
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 93b84e1bfddfb..b7fbe4b97c6db 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -688,12 +688,12 @@ struct FormatStyle {
/// };
/// \endcode
SLS_Empty,
- /// Merge lambda into a single line if argument of a function.
+ /// Merge lambda into a single line if the lambda is argument of a function.
/// \code
- /// auto lambda = [](int a) {
- /// return a;
+ /// auto lambda = [](int x, int y) {
+ /// return x < y;
/// };
- /// sort(a.begin(), a.end(), []() { return x < y; });
+ /// sort(a.begin(), a.end(), [](int x, int y) { return x < y; });
/// \endcode
SLS_Inline,
/// Merge all lambdas fitting on a single line.
More information about the cfe-commits
mailing list