[clang] [clang-format] Change BinPackParameters to enum and add AlwaysOnePerLine (PR #101882)
Owen Pan via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 20 08:52:40 PDT 2024
================
@@ -1192,20 +1192,36 @@ struct FormatStyle {
/// \version 3.7
bool BinPackArguments;
- /// If ``false``, a function declaration's or function definition's
- /// parameters will either all be on the same line or will have one line each.
- /// \code
- /// true:
- /// void f(int aaaaaaaaaaaaaaaaaaaa, int aaaaaaaaaaaaaaaaaaaa,
- /// int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
- ///
- /// false:
- /// void f(int aaaaaaaaaaaaaaaaaaaa,
- /// int aaaaaaaaaaaaaaaaaaaa,
- /// int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
- /// \endcode
+ /// Different way to try to fit all parameters on a line.
+ enum BinPackParametersStyle : int8_t {
+ /// Put all parameters on the current line if they fit.
+ /// Otherwise, put each one on its own line.
+ /// \code
+ /// void f(int a, int b, int c);
+ ///
+ /// void f(int a,
+ /// int b,
+ /// int ccccccccccccccccccccccccccccccccccccc);
+ /// \endcode
+ BPPS_OnePerLine,
+ /// Bin-pack parameters.
+ /// \code
+ /// void f(int a, int bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
+ /// int ccccccccccccccccccccccccccccccccccccccccccc);
+ /// \endcode
+ BPPS_BinPack,
----------------
owenca wrote:
```suggestion
/// Bin-pack parameters.
/// \code
/// void f(int a, int bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
/// int ccccccccccccccccccccccccccccccccccccccccccc);
/// \endcode
BPPS_BinPack,
/// Put all parameters on the current line if they fit.
/// Otherwise, put each one on its own line.
/// \code
/// void f(int a, int b, int c);
///
/// void f(int a,
/// int b,
/// int ccccccccccccccccccccccccccccccccccccc);
/// \endcode
BPPS_OnePerLine,
```
so that `OnePerLine` goes between `BinPack` and `AlwaysOnePerLine`.
https://github.com/llvm/llvm-project/pull/101882
More information about the cfe-commits
mailing list