Skip to content

Commit 48ed2cf

Browse files
committed
Fix docs.
1 parent 4c6b2fb commit 48ed2cf

File tree

2 files changed

+77
-41
lines changed

2 files changed

+77
-41
lines changed

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5204,22 +5204,46 @@ the configuration (without a prefix: ``Auto``).
52045204

52055205
.. _ReflowComments:
52065206

5207-
**ReflowComments** (``Boolean``) :versionbadge:`clang-format 3.8` :ref:`<ReflowComments>`
5208-
If ``true``, clang-format will attempt to re-flow comments. That is it
5209-
will touch a comment and *reflow* long comments into new lines, trying to
5210-
obey the ``ColumnLimit``.
5207+
**ReflowComments** (``ReflowCommentsStyle``) :versionbadge:`clang-format 20` :ref:`<ReflowComments>`
5208+
Comment reformatting style.
52115209

5212-
.. code-block:: c++
5210+
Possible values:
5211+
5212+
* ``// clang-format on`` (in configuration: ``// clang-format on``)
5213+
Leave comments untouched.
5214+
5215+
.. code-block:: c++
5216+
5217+
// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
5218+
/* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
5219+
/* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
5220+
* and a misaligned second line */
5221+
5222+
* ``// clang-format on`` (in configuration: ``// clang-format on``)
5223+
Only apply indentation rules, moving comments left or right, without
5224+
changing formatting inside the comments.
5225+
5226+
.. code-block:: c++
5227+
5228+
// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
5229+
/* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
5230+
/* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
5231+
* and a misaligned second line */
5232+
5233+
* ``// clang-format on`` (in configuration: ``// clang-format on``)
5234+
Apply indentation rules and re-flow long comments into new lines, trying
5235+
to obey the ``ColumnLimit``.
5236+
5237+
.. code-block:: c++
5238+
5239+
// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
5240+
// information
5241+
/* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
5242+
* information */
5243+
/* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
5244+
* information and a misaligned second line */
52135245
5214-
false:
5215-
// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
5216-
/* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
52175246

5218-
true:
5219-
// veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
5220-
// information
5221-
/* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
5222-
* information */
52235247

52245248
.. _RemoveBracesLLVM:
52255249

clang/include/clang/Format/Format.h

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,35 +3749,47 @@ struct FormatStyle {
37493749
/// \version 13
37503750
ReferenceAlignmentStyle ReferenceAlignment;
37513751

3752-
enum ReflowCommentsStyle : int8_t { RCS_Never, RCS_IndentOnly, RCS_Always };
3753-
// clang-format off
3754-
/// If ``true``, clang-format will attempt to re-flow comments. That is it
3755-
/// will touch a comment and *reflow* long comments into new lines, trying to
3756-
/// obey the ``ColumnLimit``.
3757-
/// \code
3758-
/// RCS_Never:
3759-
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3760-
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
3761-
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3762-
/// * and a misaligned second line */
3763-
///
3764-
/// RCS_IndentOnly:
3765-
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3766-
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
3767-
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3768-
/// * and a misaligned second line */
3769-
///
3770-
/// RCS_Always:
3771-
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3772-
/// // information
3773-
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3774-
/// * information */
3775-
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3776-
/// * information and a misaligned second line */
3777-
/// \endcode
3778-
/// \version 3.8
3752+
/// \brief Types of comment re-flow style.
3753+
enum ReflowCommentsStyle : int8_t {
3754+
// clang-format off
3755+
/// Leave comments untouched.
3756+
/// \code
3757+
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3758+
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
3759+
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3760+
/// * and a misaligned second line */
3761+
/// \endcode
3762+
// clang-format on
3763+
RCS_Never,
3764+
// clang-format off
3765+
/// Only apply indentation rules, moving comments left or right, without
3766+
/// changing formatting inside the comments.
3767+
/// \code
3768+
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3769+
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
3770+
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
3771+
/// * and a misaligned second line */
3772+
/// \endcode
3773+
// clang-format on
3774+
RCS_IndentOnly,
3775+
// clang-format off
3776+
/// Apply indentation rules and re-flow long comments into new lines, trying
3777+
/// to obey the ``ColumnLimit``.
3778+
/// \code
3779+
/// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3780+
/// // information
3781+
/// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3782+
/// * information */
3783+
/// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
3784+
/// * information and a misaligned second line */
3785+
/// \endcode
3786+
// clang-format on
3787+
RCS_Always
3788+
};
3789+
3790+
/// \brief Comment reformatting style.
3791+
/// \version 20
37793792
ReflowCommentsStyle ReflowComments;
3780-
// clang-format on
37813793

37823794
/// Remove optional braces of control statements (``if``, ``else``, ``for``,
37833795
/// and ``while``) in C++ according to the LLVM coding style.

0 commit comments

Comments
 (0)