https://github.com/vbvictor created https://github.com/llvm/llvm-project/pull/176654
It was not clear from the description what this option does. Added small example to demostrate its behavior. >From a2286ac4e494cd80081761dff82351b49fd2d16a Mon Sep 17 00:00:00 2001 From: Victor Baranov <[email protected]> Date: Sun, 18 Jan 2026 18:44:04 +0300 Subject: [PATCH] [clang-format][NFC] Improve KeepFormFeed option decription --- clang/docs/ClangFormatStyleOptions.rst | 16 ++++++++++++---- clang/include/clang/Format/Format.h | 15 +++++++++++---- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 4f81a084dd65b..74cbc040659a9 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -5012,10 +5012,18 @@ the configuration (without a prefix: ``Auto``). .. _KeepFormFeed: **KeepFormFeed** (``Boolean``) :versionbadge:`clang-format 20` :ref:`ΒΆ <KeepFormFeed>` - Keep the form feed character if it's immediately preceded and followed by - a newline. Multiple form feeds and newlines within a whitespace range are - replaced with a single newline and form feed followed by the remaining - newlines. + Keep the form feed character (``\f``) if it's immediately preceded and + followed by a newline. Multiple form feeds and newlines within a + whitespace range are replaced with a single newline and form feed + followed by the remaining newlines. + + .. code-block:: c++ + + false: true: + + "int i;\n" "int i;\n" + "\n" "\f\n" + "void f();" "void f();" .. _LambdaBodyIndentation: diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index c7e57d47f9ed1..2c8b7b5c2c0be 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -3517,10 +3517,17 @@ struct FormatStyle { /// \version 3.7 // bool KeepEmptyLinesAtTheStartOfBlocks; - /// Keep the form feed character if it's immediately preceded and followed by - /// a newline. Multiple form feeds and newlines within a whitespace range are - /// replaced with a single newline and form feed followed by the remaining - /// newlines. + /// Keep the form feed character (``\f``) if it's immediately preceded and + /// followed by a newline. Multiple form feeds and newlines within a + /// whitespace range are replaced with a single newline and form feed + /// followed by the remaining newlines. + /// \code + /// false: true: + /// + /// "int i;\n" "int i;\n" + /// "\n" "\f\n" + /// "void f();" "void f();" + /// \endcode /// \version 20 bool KeepFormFeed; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
