diff options
author | Owen Pan <owenpiano@gmail.com> | 2019-08-11 17:48:36 +0000 |
---|---|---|
committer | Owen Pan <owenpiano@gmail.com> | 2019-08-11 17:48:36 +0000 |
commit | d671e605e4d22270300406268d483eb95558f543 (patch) | |
tree | 5e778f13d567474dccae738895b2e48d21c0b471 /include/clang/Format | |
parent | c9a615ed810c08ac0190a589f2c658433d726728 (diff) | |
download | clang-d671e605e4d22270300406268d483eb95558f543.tar.gz |
[clang-format] Expand AllowShortBlocksOnASingleLine for WebKit
See PR40840
Differential Revision: https://reviews.llvm.org/D66059
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Format')
-rw-r--r-- | include/clang/Format/Format.h | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/include/clang/Format/Format.h b/include/clang/Format/Format.h index 657ec4e3e5..7a6688bbdb 100644 --- a/include/clang/Format/Format.h +++ b/include/clang/Format/Format.h @@ -216,10 +216,37 @@ struct FormatStyle { /// \endcode bool AllowAllParametersOfDeclarationOnNextLine; - /// Allows contracting simple braced statements to a single line. - /// - /// E.g., this allows ``if (a) { return; }`` to be put on a single line. - bool AllowShortBlocksOnASingleLine; + /// Different styles for merging short blocks containing at most one + /// statement. + enum ShortBlockStyle { + /// Never merge blocks into a single line. + /// \code + /// while (true) { + /// } + /// while (true) { + /// continue; + /// } + /// \endcode + SBS_Never, + /// Only merge empty blocks. + /// \code + /// while (true) {} + /// while (true) { + /// continue; + /// } + /// \endcode + SBS_Empty, + /// Always merge short blocks into a single line. + /// \code + /// while (true) {} + /// while (true) { continue; } + /// \endcode + SBS_Always, + }; + + /// Dependent on the value, ``while (true) { continue; }`` can be put on a + /// single line. + ShortBlockStyle AllowShortBlocksOnASingleLine; /// If ``true``, short case labels will be contracted to a single line. /// \code |