This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9ec5dc694478: [clang-format] Add note directive generation 
for docs (authored by gedare, committed by owenpan).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154552/new/

https://reviews.llvm.org/D154552

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/tools/dump_format_style.py
  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
@@ -92,10 +92,10 @@
     ///   )
     /// \endcode
     ///
-    /// \warning
+    /// \note
     ///  This currently only applies to braced initializer lists (when
     ///  ``Cpp11BracedListStyle`` is ``true``) and parentheses.
-    /// \endwarning
+    /// \endnote
     BAS_BlockIndent,
   };
 
@@ -134,8 +134,10 @@
   /// if not ``None``, when using initialization for an array of structs
   /// aligns the fields into columns.
   ///
-  /// NOTE: As of clang-format 15 this option only applied to arrays with equal
-  /// number of columns per row.
+  /// \note
+  ///  As of clang-format 15 this option only applied to arrays with equal
+  ///  number of columns per row.
+  /// \endnote
   ///
   /// \version 13
   ArrayInitializerAlignmentStyle AlignArrayOfStructures;
@@ -440,8 +442,10 @@
 
   /// Control of trailing comments.
   ///
-  /// NOTE: As of clang-format 16 this option is not a bool but can be set
-  /// to the options. Conventional bool options still can be parsed as before.
+  /// \note
+  ///  As of clang-format 16 this option is not a bool but can be set
+  ///  to the options. Conventional bool options still can be parsed as before.
+  /// \endnote
   ///
   /// \code{.yaml}
   ///   # Example of usage:
@@ -1094,8 +1098,10 @@
     /// \endcode
     bool AfterNamespace;
     /// Wrap ObjC definitions (interfaces, implementations...).
-    /// \note @autoreleasepool and @synchronized blocks are wrapped
-    /// according to `AfterControlStatement` flag.
+    /// \note
+    ///  @autoreleasepool and @synchronized blocks are wrapped
+    ///  according to `AfterControlStatement` flag.
+    /// \endnote
     bool AfterObjCDeclaration;
     /// Wrap struct definitions.
     /// \code
@@ -1290,7 +1296,9 @@
   /// otherwise it will scan until the closing `]` to determine if it should add
   /// newlines between elements (prettier compatible).
   ///
-  /// NOTE: This is currently only for formatting JSON.
+  /// \note
+  ///  This is currently only for formatting JSON.
+  /// \endnote
   /// \code
   ///    true:                                  false:
   ///    [                          vs.      [1, 2, 3, 4]
@@ -2180,8 +2188,10 @@
   /// made, clang-format analyzes whether there are other bin-packed cases in
   /// the input file and act accordingly.
   ///
-  /// NOTE: This is an experimental flag, that might go away or be renamed. Do
-  /// not use this in config files, etc. Use at your own risk.
+  /// \note
+  ///  This is an experimental flag, that might go away or be renamed. Do
+  ///  not use this in config files, etc. Use at your own risk.
+  /// \endnote
   /// \version 3.7
   bool ExperimentalAutoDetectBinPacking;
 
@@ -3200,10 +3210,13 @@
   ///   * restrict
   ///   * type
   ///
-  /// Note: it MUST contain 'type'.
+  /// \note
+  ///  it MUST contain 'type'.
+  /// \endnote
+  ///
   /// Items to the left of 'type' will be placed to the left of the type and
-  /// aligned in the order supplied. Items to the right of 'type' will be placed
-  /// to the right of the type and aligned in the order supplied.
+  /// aligned in the order supplied. Items to the right of 'type' will be
+  /// placed to the right of the type and aligned in the order supplied.
   ///
   /// \code{.yaml}
   ///   QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]
Index: clang/docs/tools/dump_format_style.py
===================================================================
--- clang/docs/tools/dump_format_style.py
+++ clang/docs/tools/dump_format_style.py
@@ -257,6 +257,14 @@
         endwarning_match = re.match(r"^/// +\\endwarning$", line)
         if endwarning_match:
             return ""
+
+        match = re.match(r"^/// \\note$", line)
+        if match:
+            return "\n.. note::\n\n"
+
+        endnote_match = re.match(r"^/// +\\endnote$", line)
+        if endnote_match:
+            return ""
         return line[4:] + "\n"
 
     def read_options(self):
Index: clang/docs/ClangFormatStyleOptions.rst
===================================================================
--- clang/docs/ClangFormatStyleOptions.rst
+++ clang/docs/ClangFormatStyleOptions.rst
@@ -239,7 +239,7 @@
       )
 
 
-    .. warning::
+    .. note::
 
      This currently only applies to braced initializer lists (when
      ``Cpp11BracedListStyle`` is ``true``) and parentheses.
@@ -252,8 +252,11 @@
   if not ``None``, when using initialization for an array of structs
   aligns the fields into columns.
 
-  NOTE: As of clang-format 15 this option only applied to arrays with equal
-  number of columns per row.
+
+  .. note::
+
+   As of clang-format 15 this option only applied to arrays with equal
+   number of columns per row.
 
   Possible values:
 
@@ -879,8 +882,11 @@
 **AlignTrailingComments** (``TrailingCommentsAlignmentStyle``) :versionbadge:`clang-format 3.7` :ref:`¶ <AlignTrailingComments>`
   Control of trailing comments.
 
-  NOTE: As of clang-format 16 this option is not a bool but can be set
-  to the options. Conventional bool options still can be parsed as before.
+
+  .. note::
+
+   As of clang-format 16 this option is not a bool but can be set
+   to the options. Conventional bool options still can be parsed as before.
 
 
   .. code-block:: yaml
@@ -1677,8 +1683,11 @@
       }
 
   * ``bool AfterObjCDeclaration`` Wrap ObjC definitions (interfaces, implementations...).
-    @autoreleasepool and @synchronized blocks are wrapped
-    according to `AfterControlStatement` flag.
+
+    .. note::
+
+     @autoreleasepool and @synchronized blocks are wrapped
+     according to `AfterControlStatement` flag.
 
   * ``bool AfterStruct`` Wrap struct definitions.
 
@@ -1921,7 +1930,10 @@
   otherwise it will scan until the closing `]` to determine if it should add
   newlines between elements (prettier compatible).
 
-  NOTE: This is currently only for formatting JSON.
+
+  .. note::
+
+   This is currently only for formatting JSON.
 
   .. code-block:: c++
 
@@ -2877,8 +2889,11 @@
   made, clang-format analyzes whether there are other bin-packed cases in
   the input file and act accordingly.
 
-  NOTE: This is an experimental flag, that might go away or be renamed. Do
-  not use this in config files, etc. Use at your own risk.
+
+  .. note::
+
+   This is an experimental flag, that might go away or be renamed. Do
+   not use this in config files, etc. Use at your own risk.
 
 .. _FixNamespaceComments:
 
@@ -4177,10 +4192,14 @@
     * restrict
     * type
 
-  Note: it MUST contain 'type'.
+
+  .. note::
+
+   it MUST contain 'type'.
+
   Items to the left of 'type' will be placed to the left of the type and
-  aligned in the order supplied. Items to the right of 'type' will be placed
-  to the right of the type and aligned in the order supplied.
+  aligned in the order supplied. Items to the right of 'type' will be
+  placed to the right of the type and aligned in the order supplied.
 
 
   .. code-block:: yaml
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to