[clang-format][doc] Fix doc format for IntegerLiteralSeparator
authorOwen Pan <owenpiano@gmail.com>
Wed, 11 Jan 2023 10:17:54 +0000 (02:17 -0800)
committerOwen Pan <owenpiano@gmail.com>
Wed, 11 Jan 2023 11:23:34 +0000 (03:23 -0800)
clang/docs/ClangFormatStyleOptions.rst
clang/include/clang/Format/Format.h

index 23f5786..fd2a943 100644 (file)
@@ -3169,24 +3169,42 @@ the configuration (without a prefix: ``Auto``).
   Nested configuration flags:
 
   Separator format of integer literals of different bases.
-  If <0: Remove separators.
-  If  0: Leave the literal as is.
-  If >0: Insert separators between digits starting from the rightmost digit.
 
-  * ``int8_t Binary`` .. code-block:: c++
+  If negative, remove separators. If  ``0``, leave the literal as is. If
+  positive, insert separators between digits starting from the rightmost
+  digit.
+
+  For example, the config below will leave separators in binary literals
+  alone, insert separators in decimal literals to separate the digits into
+  groups of 3, and remove separators in hexadecimal literals.
+
+  .. code-block:: c++
+
+    IntegerLiteralSeparator:
+      Binary: 0
+      Decimal: 3
+      Hex: -1
+
+  * ``int8_t Binary`` Format separators in binary literals.
+
+    .. code-block:: c++
 
        -1: 0b100111101101
         0: 0b10011'11'0110'1
         3: 0b100'111'101'101
         4: 0b1001'1110'1101
 
-  * ``int8_t Decimal`` .. code-block:: c++
+  * ``int8_t Decimal`` Format separators in decimal literals.
+
+    .. code-block:: c++
 
        -1: 18446744073709550592ull
         0: 184467'440737'0'95505'92ull
         3: 18'446'744'073'709'550'592ull
 
-  * ``int8_t Hex`` .. code-block:: c++
+  * ``int8_t Hex`` Format separators in hexadecimal literals.
+
+    .. code-block:: c++
 
        -1: 0xDEADBEEFDEADBEEFuz
         0: 0xDEAD'BEEF'DE'AD'BEE'Fuz
index 3a7a183..5d5a044 100644 (file)
@@ -2455,10 +2455,22 @@ struct FormatStyle {
   TrailingCommaStyle InsertTrailingCommas;
 
   /// Separator format of integer literals of different bases.
-  /// If <0: Remove separators.
-  /// If  0: Leave the literal as is.
-  /// If >0: Insert separators between digits starting from the rightmost digit.
+  ///
+  /// If negative, remove separators. If  ``0``, leave the literal as is. If
+  /// positive, insert separators between digits starting from the rightmost
+  /// digit.
+  ///
+  /// For example, the config below will leave separators in binary literals
+  /// alone, insert separators in decimal literals to separate the digits into
+  /// groups of 3, and remove separators in hexadecimal literals.
+  /// \code
+  ///   IntegerLiteralSeparator:
+  ///     Binary: 0
+  ///     Decimal: 3
+  ///     Hex: -1
+  /// \endcode
   struct IntegerLiteralSeparatorStyle {
+    /// Format separators in binary literals.
     /// \code
     ///    -1: 0b100111101101
     ///     0: 0b10011'11'0110'1
@@ -2466,12 +2478,14 @@ struct FormatStyle {
     ///     4: 0b1001'1110'1101
     /// \endcode
     int8_t Binary;
+    /// Format separators in decimal literals.
     /// \code
     ///    -1: 18446744073709550592ull
     ///     0: 184467'440737'0'95505'92ull
     ///     3: 18'446'744'073'709'550'592ull
     /// \endcode
     int8_t Decimal;
+    /// Format separators in hexadecimal literals.
     /// \code
     ///    -1: 0xDEADBEEFDEADBEEFuz
     ///     0: 0xDEAD'BEEF'DE'AD'BEE'Fuz