[clang] Add support for aligning BlockComments in declarations (PR #109497)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 21 00:39:52 PDT 2024


================
@@ -275,13 +275,36 @@ struct FormatStyle {
     ///   bbb >>= 2;
     /// \endcode
     bool PadOperators;
+    /// Only for ``AlignConsecutiveDeclarations``.  Whether block comments
+    /// are aligned in declarations.
+    /// \code
+    ///   true:
+    ///   someLongFunction(int                /*a*/,
+    ///                    bool               b,
+    ///                    const std::string& c)
+    ///
+    ///   const bool ret = someLongFunction(4    /*a*/,
+    ///                                     true /*b*/,
+    ///                                     str  /*c*/);
+    ///
+    ///   false:
+    ///   someLongFunction(int /*a*/,
+    ///                    bool b,
+    ///                    const std::string& c)
+    ///
+    ///   const bool ret = someLongFunction(4 /*a*/,
+    ///                                     true /*b*/,
+    ///                                     str /*c*/);
+    /// \endcode
+    bool AlignBlockComments;
     bool operator==(const AlignConsecutiveStyle &R) const {
       return Enabled == R.Enabled && AcrossEmptyLines == R.AcrossEmptyLines &&
              AcrossComments == R.AcrossComments &&
              AlignCompound == R.AlignCompound &&
              AlignFunctionDeclarations == R.AlignFunctionDeclarations &&
              AlignFunctionPointers == R.AlignFunctionPointers &&
-             PadOperators == R.PadOperators;
+             PadOperators == R.PadOperators &&
+             AlignBlockComments == R.AlignBlockComments;
----------------
owenca wrote:

Ditto.

https://github.com/llvm/llvm-project/pull/109497


More information about the cfe-commits mailing list