[clang] a2a826d - [clang-format][docs][NFC] correct the "first supported versions" of some of the clang-format options

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 9 03:03:17 PDT 2021


Author: mydeveloperday
Date: 2021-10-09T11:02:49+01:00
New Revision: a2a826d8b66cfc85499a92949767d153563078a0

URL: https://github.com/llvm/llvm-project/commit/a2a826d8b66cfc85499a92949767d153563078a0
DIFF: https://github.com/llvm/llvm-project/commit/a2a826d8b66cfc85499a92949767d153563078a0.diff

LOG: [clang-format][docs][NFC] correct the "first supported versions" of some of the clang-format options

Some of the first supported version field were incorrectly attributed to a later branch.

It wasn't possible to correctly determine the "introduced version" with my naive implementation
using git blame alone, (especially if the type had been changed from a bool -> enum)

I saw more things attributed to clang-format 13 than I remembered and reviewed
those options to determine their introduced version.

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D110803

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index c05fbc753614e..e2e044145018b 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -247,7 +247,7 @@ the configuration (without a prefix: ``Auto``).
 
 
 
-**AlignConsecutiveAssignments** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 13`
+**AlignConsecutiveAssignments** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 3.8`
   Style of aligning consecutive assignments.
 
   ``Consecutive`` will result in formattings like:
@@ -320,7 +320,7 @@ the configuration (without a prefix: ``Auto``).
        /* A comment. */
        double e         = 4;
 
-**AlignConsecutiveBitFields** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 13`
+**AlignConsecutiveBitFields** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 11`
   Style of aligning consecutive bit field.
 
   ``Consecutive`` will align the bitfield separators of consecutive lines.
@@ -394,7 +394,7 @@ the configuration (without a prefix: ``Auto``).
        /* A comment. */
        int ee   : 3;
 
-**AlignConsecutiveDeclarations** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 13`
+**AlignConsecutiveDeclarations** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 3.8`
   Style of aligning consecutive declarations.
 
   ``Consecutive`` will align the declaration names of consecutive lines.
@@ -468,7 +468,7 @@ the configuration (without a prefix: ``Auto``).
        /* A comment. */
        bool        c = false;
 
-**AlignConsecutiveMacros** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 13`
+**AlignConsecutiveMacros** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 9`
   Style of aligning consecutive macro definitions.
 
   ``Consecutive`` will result in formattings like:
@@ -1082,7 +1082,7 @@ the configuration (without a prefix: ``Auto``).
 
 
 
-**AttributeMacros** (``List of Strings``) :versionbadge:`clang-format 13`
+**AttributeMacros** (``List of Strings``) :versionbadge:`clang-format 12`
   A vector of strings that should be interpreted as attributes/qualifiers
   instead of identifiers. This can be useful for language extensions or
   static analyzer annotations.
@@ -1135,7 +1135,7 @@ the configuration (without a prefix: ``Auto``).
            int aaaaaaaaaaaaaaaaaaaa,
            int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}
 
-**BitFieldColonSpacing** (``BitFieldColonSpacingStyle``) :versionbadge:`clang-format 13`
+**BitFieldColonSpacing** (``BitFieldColonSpacingStyle``) :versionbadge:`clang-format 12`
   The BitFieldColonSpacingStyle to use for bitfields.
 
   Possible values:
@@ -3197,7 +3197,7 @@ the configuration (without a prefix: ``Auto``).
 **PenaltyExcessCharacter** (``Unsigned``) :versionbadge:`clang-format 3.7`
   The penalty for each character outside of the column limit.
 
-**PenaltyIndentedWhitespace** (``Unsigned``) :versionbadge:`clang-format 13`
+**PenaltyIndentedWhitespace** (``Unsigned``) :versionbadge:`clang-format 12`
   Penalty for each character of whitespace indentation
   (counted relative to leading non-whitespace column).
 
@@ -3301,8 +3301,9 @@ the configuration (without a prefix: ``Auto``).
     * 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.
+  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
@@ -3461,7 +3462,7 @@ the configuration (without a prefix: ``Auto``).
 
 
 
-**SortJavaStaticImport** (``SortJavaStaticImportOptions``) :versionbadge:`clang-format 13`
+**SortJavaStaticImport** (``SortJavaStaticImportOptions``) :versionbadge:`clang-format 12`
   When sorting Java imports, by default static imports are placed before
   non-static imports. If ``JavaStaticImportAfterImport`` is ``After``,
   static imports are placed after non-static imports.
@@ -3529,7 +3530,7 @@ the configuration (without a prefix: ``Auto``).
      true:                                  false:
      template <int> void foo();     vs.     template<int> void foo();
 
-**SpaceAroundPointerQualifiers** (``SpaceAroundPointerQualifiersStyle``) :versionbadge:`clang-format 13`
+**SpaceAroundPointerQualifiers** (``SpaceAroundPointerQualifiersStyle``) :versionbadge:`clang-format 12`
   Defines in which cases to put a space before or after pointer qualifiers
 
   Possible values:
@@ -3578,7 +3579,7 @@ the configuration (without a prefix: ``Auto``).
      int a = 5;                     vs.     int a= 5;
      a += 42;                               a+= 42;
 
-**SpaceBeforeCaseColon** (``Boolean``) :versionbadge:`clang-format 13`
+**SpaceBeforeCaseColon** (``Boolean``) :versionbadge:`clang-format 12`
   If ``false``, spaces will be removed before case colon.
 
   .. code-block:: c++
@@ -3893,7 +3894,7 @@ the configuration (without a prefix: ``Auto``).
 
 
 
-**StatementAttributeLikeMacros** (``List of Strings``) :versionbadge:`clang-format 13`
+**StatementAttributeLikeMacros** (``List of Strings``) :versionbadge:`clang-format 12`
   Macros which are ignored in front of a statement, as if they were an
   attribute. So that they are not parsed as identifier, for example for Qts
   emit.

diff  --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index df553c3428052..77565797b28b5 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -208,7 +208,7 @@ struct FormatStyle {
   ///      /* some comment */
   ///      #define bar(y, z)        (y + z)
   ///    \endcode
-  /// \version 13
+  /// \version 9
   AlignConsecutiveStyle AlignConsecutiveMacros;
 
   /// Style of aligning consecutive assignments.
@@ -277,7 +277,7 @@ struct FormatStyle {
   ///      /* A comment. */
   ///      double e         = 4;
   ///    \endcode
-  /// \version 13
+  /// \version 3.8
   AlignConsecutiveStyle AlignConsecutiveAssignments;
 
   /// Style of aligning consecutive bit field.
@@ -347,7 +347,7 @@ struct FormatStyle {
   ///      /* A comment. */
   ///      int ee   : 3;
   ///    \endcode
-  /// \version 13
+  /// \version 11
   AlignConsecutiveStyle AlignConsecutiveBitFields;
 
   /// Style of aligning consecutive declarations.
@@ -417,7 +417,7 @@ struct FormatStyle {
   ///      /* A comment. */
   ///      bool        c = false;
   ///    \endcode
-  /// \version 13
+  /// \version 3.8
   AlignConsecutiveStyle AlignConsecutiveDeclarations;
 
   /// Different styles for aligning escaped newlines.
@@ -930,7 +930,7 @@ struct FormatStyle {
   ///   AttributeMacros: ['__capability', '__output', '__ununsed']
   /// \endcode
   ///
-  /// \version 13
+  /// \version 12
   std::vector<std::string> AttributeMacros;
 
   /// If ``false``, a function call's arguments will either be all on the
@@ -1919,8 +1919,9 @@ struct FormatStyle {
   ///   * 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.
+  /// 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{.yaml}
   ///   QualifierOrder: ['inline', 'static', 'type', 'const', 'volatile' ]
@@ -2904,7 +2905,7 @@ struct FormatStyle {
 
   /// Penalty for each character of whitespace indentation
   /// (counted relative to leading non-whitespace column).
-  /// \version 13
+  /// \version 12
   unsigned PenaltyIndentedWhitespace;
 
   /// The ``&``, ``&&`` and ``*`` alignment style.
@@ -3131,7 +3132,7 @@ struct FormatStyle {
   /// When sorting Java imports, by default static imports are placed before
   /// non-static imports. If ``JavaStaticImportAfterImport`` is ``After``,
   /// static imports are placed after non-static imports.
-  /// \version 13
+  /// \version 12
   SortJavaStaticImportOptions SortJavaStaticImport;
 
   /// If ``true``, clang-format will sort using declarations.
@@ -3205,7 +3206,7 @@ struct FormatStyle {
   };
 
   ///  Defines in which cases to put a space before or after pointer qualifiers
-  /// \version 13
+  /// \version 12
   SpaceAroundPointerQualifiersStyle SpaceAroundPointerQualifiers;
 
   /// If ``false``, spaces will be removed before assignment operators.
@@ -3224,7 +3225,7 @@ struct FormatStyle {
   ///     case 1 : break;                         case 1: break;
   ///   }                                       }
   /// \endcode
-  /// \version 13
+  /// \version 12
   bool SpaceBeforeCaseColon;
 
   /// If ``true``, a space will be inserted before a C++11 braced list
@@ -3511,7 +3512,7 @@ struct FormatStyle {
     BFCS_After
   };
   /// The BitFieldColonSpacingStyle to use for bitfields.
-  /// \version 13
+  /// \version 12
   BitFieldColonSpacingStyle BitFieldColonSpacing;
 
   /// Supported language standards for parsing and formatting C++ constructs.
@@ -3563,7 +3564,7 @@ struct FormatStyle {
   ///   unsigned char data = 'x';
   ///   emit signal(data); // Now it's fine again.
   /// \endcode
-  /// \version 13
+  /// \version 12
   std::vector<std::string> StatementAttributeLikeMacros;
 
   /// The number of columns used for tab stops.


        


More information about the cfe-commits mailing list