[PATCH] D137075: [clang-format] Fix document of AlignTrailingComments

Yusuke Kadowaki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 05:04:17 PDT 2022


yusuke-kadowaki created this revision.
Herald added a project: All.
yusuke-kadowaki edited the summary of this revision.
yusuke-kadowaki added reviewers: MyDeveloperDay, HazardyKnusperkeks.
yusuke-kadowaki published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137075

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


Index: clang/include/clang/Format/Format.h
===================================================================
--- clang/include/clang/Format/Format.h
+++ clang/include/clang/Format/Format.h
@@ -402,11 +402,11 @@
 
   /// 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,
-    /// \code
+    /// 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
     ///
     ///   int ab;     // comments are
@@ -414,8 +414,8 @@
     ///
     ///   int abcdef; // aligned
     /// \endcode
-    /// And with ``MaxEmptyLinesToKeep`` is 2 and ``OverEmptyLines`` is 1,
-    /// \code
+    /// When ``MaxEmptyLinesToKeep`` is set to 2 and ``OverEmptyLines`` is set
+    /// to 1, it formats like below. \code
     ///   int a;  // these are
     ///
     ///   int ab; // aligned
Index: clang/docs/ClangFormatStyleOptions.rst
===================================================================
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -865,7 +865,7 @@
   Alignment options
 
   * ``TrailingCommentsAlignmentKinds Kind``
-    Specifies the way to align trailing comments
+    Specifies the way to align trailing comments.
 
     Possible values:
 
@@ -903,8 +903,8 @@
         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++
 
@@ -914,8 +914,7 @@
 
 
       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++
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137075.471970.patch
Type: text/x-patch
Size: 2263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221031/a30bf2bd/attachment.bin>


More information about the cfe-commits mailing list