MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: mprobst, krasimir, mitchell-stellar, asmith.
MyDeveloperDay added projects: clang, clang-format.
MyDeveloperDay edited the summary of this revision.
MyDeveloperDay marked an inline comment as done.
MyDeveloperDay added inline comments.
MyDeveloperDay retitled this revision from "[clang-format] NFC Correct 
clang-format headers file so documentation can be one again autogenerated" to 
"[clang-format] NFC Correct clang-format headers file so documentation can be 
once again autogenerated".


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:1752
      LoooooooooooooooooooooooooooooooongFunctionDeclaration();
 
+**InsertTrailingCommas** (``TrailingCommaStyle``)
----------------
NOTE: options are alphabetic in Format.h and so the position within the rst 
file will change.


`ClangFormatStyleOptions.rst` should ALWAYS be autogenerated from Format.h 
using `clang/docs/tools/dump_format_style.py` if not its liable to get removed 
leaving options undocumented.

This revision reworks the documentation for D73354: clang-format: insert 
trailing commas into containers. <https://reviews.llvm.org/D73354> D73768: 
clang-format: [JS] document InsertTrailingCommas. 
<https://reviews.llvm.org/D73768> to ensure we can continue to regenerated

Fix other minor changes that ensure the documentation remains consistent 
(Format.h obviously got re clang-formatted after the rst had been regenerated 
previously)

Generated documentation will look like

F11824218: image.png <https://reviews.llvm.org/F11824218>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79095

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
@@ -561,6 +561,21 @@
     TCS_Wrapped,
   };
 
+  /// If set to ``TCS_Wrapped`` will insert trailing commas in container
+  /// literals (arrays and objects) that wrap across multiple lines.
+  /// It is currently only available for JavaScript
+  /// and disabled by default ``TCS_None``.
+  /// ``InsertTrailingCommas`` cannot be used together with ``BinPackArguments``
+  /// as inserting the comma disables bin-packing.
+  /// \code
+  ///   TSC_Wrapped:
+  ///   const someArray = [
+  ///   aaaaaaaaaaaaaaaaaaaaaaaaaa,
+  ///   aaaaaaaaaaaaaaaaaaaaaaaaaa,
+  ///   aaaaaaaaaaaaaaaaaaaaaaaaaa,
+  ///   //                        ^ inserted
+  ///   ]
+  /// \endcode
   TrailingCommaStyle InsertTrailingCommas;
 
   /// If ``false``, a function declaration's or function definition's
@@ -2133,7 +2148,7 @@
     /// appears within a line (e.g. consecutive assignments and declarations).
     UT_ForContinuationAndIndentation,
     /// Use tabs for line continuation and indentation, and spaces for
-    /// alignemnt.
+    /// alignment.
     UT_AlignWithSpaces,
     /// Use tabs whenever we need to fill whitespace that spans at least from
     /// one tab stop to the next one.
Index: clang/docs/ClangFormatStyleOptions.rst
===================================================================
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -717,26 +717,6 @@
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
     }
 
-
-**InsertTrailingCommas** (``TrailingCommaStyle``) can be set to ``TCS_Wrapped``
-  to insert trailing commas in container literals (arrays and objects) that wrap
-  across multiple lines. It is currently only available for JavaScript and
-  disabled by default (``TCS_None``).
-
-  ``InsertTrailingCommas`` cannot be used together with ``BinPackArguments`` as
-  inserting the comma disables bin-packing.
-
-  .. code-block:: c++
-
-    TSC_Wrapped:
-    const someArray = [
-      aaaaaaaaaaaaaaaaaaaaaaaaaa,
-      aaaaaaaaaaaaaaaaaaaaaaaaaa,
-      aaaaaaaaaaaaaaaaaaaaaaaaaa,
-      //                        ^ inserted
-    ]
-
-
 **BinPackParameters** (``bool``)
   If ``false``, a function declaration's or function definition's
   parameters will either all be on the same line or will have one line each.
@@ -1770,6 +1750,38 @@
      LoooooooooooooooooooooooooooooooooooooooongReturnType
      LoooooooooooooooooooooooooooooooongFunctionDeclaration();
 
+**InsertTrailingCommas** (``TrailingCommaStyle``)
+  If set to ``TCS_Wrapped`` will insert trailing commas in container
+  literals (arrays and objects) that wrap across multiple lines.
+  It is currently only available for JavaScript
+  and disabled by default ``TCS_None``.
+  ``InsertTrailingCommas`` cannot be used together with ``BinPackArguments``
+  as inserting the comma disables bin-packing.
+
+  .. code-block:: c++
+
+    TSC_Wrapped:
+    const someArray = [
+    aaaaaaaaaaaaaaaaaaaaaaaaaa,
+    aaaaaaaaaaaaaaaaaaaaaaaaaa,
+    aaaaaaaaaaaaaaaaaaaaaaaaaa,
+    //                        ^ inserted
+    ]
+
+  Possible values:
+
+  * ``TCS_None`` (in configuration: ``None``)
+    Do not insert trailing commas.
+
+  * ``TCS_Wrapped`` (in configuration: ``Wrapped``)
+    Insert trailing commas in container literals that were wrapped over
+    multiple lines. Note that this is conceptually incompatible with
+    bin-packing, because the trailing comma is used as an indicator
+    that a container should be formatted one-per-line (i.e. not bin-packed).
+    So inserting a trailing comma counteracts bin-packing.
+
+
+
 **JavaImportGroups** (``std::vector<std::string>``)
   A vector of prefixes ordered by the desired groups for Java imports.
 
@@ -2064,7 +2076,8 @@
     false:
      - (void)_aMethod
      {
-         [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+         [self.test1 t:self w:self callback:^(typeof(self) self, NSNumber
+         *u, NSNumber *v) {
              u = c;
          }]
      }
@@ -2072,8 +2085,8 @@
      - (void)_aMethod
      {
         [self.test1 t:self
-                    w:self
-             callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
+                     w:self
+            callback:^(typeof(self) self, NSNumber *u, NSNumber *v) {
                  u = c;
              }]
      }
@@ -2538,7 +2551,8 @@
     appears within a line (e.g. consecutive assignments and declarations).
 
   * ``UT_AlignWithSpaces`` (in configuration: ``AlignWithSpaces``)
-    Use tabs for line continuation and indentation, and spaces for alignment.
+    Use tabs for line continuation and indentation, and spaces for
+    alignment.
 
   * ``UT_Always`` (in configuration: ``Always``)
     Use tabs whenever we need to fill whitespace that spans at least from
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to