[clang] [clang-format] Introduce "ReflowComments: IndentOnly" to re-indent comments without breaking internal structure (think Doxygen). (PR #96804)
Iuri Chaer via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 27 14:04:03 PDT 2024
================
@@ -3749,24 +3749,47 @@ struct FormatStyle {
/// \version 13
ReferenceAlignmentStyle ReferenceAlignment;
- // clang-format off
- /// If ``true``, clang-format will attempt to re-flow comments. That is it
- /// will touch a comment and *reflow* long comments into new lines, trying to
- /// obey the ``ColumnLimit``.
- /// \code
- /// false:
- /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
- /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
- ///
- /// true:
- /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
- /// // information
- /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
- /// * information */
- /// \endcode
- /// \version 3.8
- bool ReflowComments;
- // clang-format on
+ /// \brief Types of comment re-flow style.
+ enum ReflowCommentsStyle : int8_t {
+ // clang-format off
+ /// Leave comments untouched.
+ /// \code
+ /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// * and a misaligned second line */
+ /// \endcode
+ // clang-format on
+ RCS_Never,
+ // clang-format off
+ /// Only apply indentation rules, moving comments left or right, without
+ /// changing formatting inside the comments.
+ /// \code
+ /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of information
+ /// * and a misaligned second line */
+ /// \endcode
+ // clang-format on
+ RCS_IndentOnly,
+ // clang-format off
+ /// Apply indentation rules and re-flow long comments into new lines, trying
+ /// to obey the ``ColumnLimit``.
+ /// \code
+ /// // veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ /// // information
+ /// /* second veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ /// * information */
+ /// /* third veryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLongComment with plenty of
+ /// * information and a misaligned second line */
+ /// \endcode
+ // clang-format on
+ RCS_Always
+ };
+
+ /// \brief Comment reformatting style.
+ /// \version 20
----------------
ichaer wrote:
lol, why have I changed that :sweat_smile:
https://github.com/llvm/llvm-project/pull/96804
More information about the cfe-commits
mailing list