[clang] 691774d - [clang-format][NFC] Fix document of AlignTrailingComments

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 3 05:13:09 PDT 2022


Author: Yusuke Kadowaki
Date: 2022-11-03T13:12:51+01:00
New Revision: 691774d4030d9b7f2941946d9a78acce92f87310

URL: https://github.com/llvm/llvm-project/commit/691774d4030d9b7f2941946d9a78acce92f87310
DIFF: https://github.com/llvm/llvm-project/commit/691774d4030d9b7f2941946d9a78acce92f87310.diff

LOG: [clang-format][NFC] Fix document of AlignTrailingComments

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

Added: 
    

Modified: 
    clang/docs/ClangFormatStyleOptions.rst
    clang/include/clang/Format/Format.h

Removed: 
    


################################################################################
diff  --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 0416190a2fd52..44f05cf28270b 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -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:
 
@@ -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++
 
@@ -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++
 

diff  --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index 6981dc158d241..3cadb6304dced 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -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
     ///
@@ -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
     ///


        


More information about the cfe-commits mailing list