Skip to content

Commit

Permalink
[clang-format][NFC] Fix document of AlignTrailingComments
Browse files Browse the repository at this point in the history
The documentation of the patch https://reviews.llvm.org/D132131 looks
disorganized on the website
https://clang.llvm.org/docs/ClangFormatStyleOptions.html.
This patch tries to fix that.

Differential Revision: https://reviews.llvm.org/D137075
  • Loading branch information
ykadowak authored and HazardyKnusperkeks committed Nov 3, 2022
1 parent f97639c commit 691774d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 6 additions & 4 deletions clang/docs/ClangFormatStyleOptions.rst
Expand Up @@ -865,7 +865,7 @@ the configuration (without a prefix: ``Auto``).
Alignment options

* ``TrailingCommentsAlignmentKinds Kind``
Specifies the way to align trailing comments
Specifies the way to align trailing comments.

Possible values:

Expand Down Expand Up @@ -903,8 +903,9 @@ the configuration (without a prefix: ``Auto``).
int abcd; // comment


* ``unsigned OverEmptyLines`` How many empty lines to apply alignment
With ``MaxEmptyLinesToKeep`` is 2 and ``OverEmptyLines`` is 2,
* ``unsigned OverEmptyLines`` How many empty lines to apply alignment.
When both ``MaxEmptyLinesToKeep`` and ``OverEmptyLines`` are set to 2,
it formats like below.

.. code-block:: c++

Expand All @@ -915,7 +916,8 @@ the configuration (without a prefix: ``Auto``).

int abcdef; // aligned

And with ``MaxEmptyLinesToKeep`` is 2 and ``OverEmptyLines`` is 1,
When ``MaxEmptyLinesToKeep`` is set to 2 and ``OverEmptyLines`` is set
to 1, it formats like below.

.. code-block:: c++

Expand Down
11 changes: 7 additions & 4 deletions clang/include/clang/Format/Format.h
Expand Up @@ -402,10 +402,11 @@ struct FormatStyle {

/// Alignment options
struct TrailingCommentsAlignmentStyle {
/// Specifies the way to align trailing comments
/// Specifies the way to align trailing comments.
TrailingCommentsAlignmentKinds Kind;
/// How many empty lines to apply alignment
/// With ``MaxEmptyLinesToKeep`` is 2 and ``OverEmptyLines`` is 2,
/// How many empty lines to apply alignment.
/// When both ``MaxEmptyLinesToKeep`` and ``OverEmptyLines`` are set to 2,
/// it formats like below.
/// \code
/// int a; // all these
///
Expand All @@ -414,7 +415,9 @@ struct FormatStyle {
///
/// int abcdef; // aligned
/// \endcode
/// And with ``MaxEmptyLinesToKeep`` is 2 and ``OverEmptyLines`` is 1,
///
/// When ``MaxEmptyLinesToKeep`` is set to 2 and ``OverEmptyLines`` is set
/// to 1, it formats like below.
/// \code
/// int a; // these are
///
Expand Down

0 comments on commit 691774d

Please sign in to comment.