diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -251,8 +251,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: @@ -878,8 +881,11 @@ **AlignTrailingComments** (``TrailingCommentsAlignmentStyle``) :versionbadge:`clang-format 3.7` :ref:`ΒΆ ` 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 @@ -1676,8 +1682,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. @@ -1920,7 +1929,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++ @@ -2876,8 +2888,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: @@ -4176,10 +4191,13 @@ * restrict * 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. + + .. 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. .. code-block:: yaml diff --git a/clang/docs/tools/dump_format_style.py b/clang/docs/tools/dump_format_style.py --- a/clang/docs/tools/dump_format_style.py +++ b/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): diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -133,8 +133,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; @@ -439,8 +441,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: @@ -1093,8 +1097,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 @@ -1289,7 +1295,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] @@ -2179,8 +2187,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; @@ -3199,10 +3209,12 @@ /// * restrict /// * 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. + /// \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. + /// \endnote /// /// \code{.yaml} /// QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]