https://github.com/niXman updated 
https://github.com/llvm/llvm-project/pull/190657

>From 189602113f7336b9dca3f9c21e20afe834893f7c Mon Sep 17 00:00:00 2001
From: niXman <[email protected]>
Date: Mon, 6 Apr 2026 22:17:47 +0300
Subject: [PATCH 1/5] initial impl

---
 clang/docs/ClangFormatStyleOptions.rst     | 20 ++++++++++++++++++++
 clang/include/clang/Format/Format.h        | 20 ++++++++++++++++++++
 clang/lib/Format/Format.cpp                |  6 ++++++
 clang/lib/Format/TokenAnnotator.cpp        |  4 ++++
 clang/unittests/Format/ConfigParseTest.cpp |  2 ++
 clang/unittests/Format/FormatTest.cpp      |  6 ++++++
 6 files changed, 58 insertions(+)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index ed4e2aaa26052..84a7569d50c27 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -6678,6 +6678,26 @@ the configuration (without a prefix: ``Auto``).
      true:                                  false:
      class Foo : Bar {}             vs.     class Foo: Bar {}
 
+.. _SpaceAfterCtorInitializerColon:
+
+**SpaceAfterCtorInitializerColon** (``Boolean``) :versionbadge:`clang-format 
22` :ref:`¶ <SpaceAfterCtorInitializerColon>`
+  If ``false``, spaces will be removed after constructor initializer colon.
+
+  .. code-block:: c++
+
+     true:                                  false:
+     Foo::Foo() : a(a) {}                   Foo::Foo() :a(a) {}
+
+.. _SpaceAfterCtorInitializerComma:
+
+**SpaceAfterCtorInitializerComma** (``Boolean``) :versionbadge:`clang-format 
22` :ref:`¶ <SpaceAfterCtorInitializerComma>`
+  If ``false``, spaces will be removed after constructor initializer comma.
+
+  .. code-block:: c++
+
+     true:                                  false:
+     Foo::Foo() : a(a), b(b) {}             Foo::Foo() : a(a),b(b) {}
+
 .. _SpaceBeforeJsonColon:
 
 **SpaceBeforeJsonColon** (``Boolean``) :versionbadge:`clang-format 17` :ref:`¶ 
<SpaceBeforeJsonColon>`
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 2028c963ac306..b70b47aa6a5cb 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -4955,6 +4955,22 @@ struct FormatStyle {
   /// \version 7
   bool SpaceBeforeCtorInitializerColon;
 
+  /// If ``false``, spaces will be removed after constructor initializer colon.
+  /// \code
+  ///    true:                                  false:
+  ///    Foo::Foo() : a(a) {}                   Foo::Foo() :a(a) {}
+  /// \endcode
+  /// \version 22
+  bool SpaceAfterCtorInitializerColon;
+
+  /// If ``false``, spaces will be removed after constructor initializer comma.
+  /// \code
+  ///    true:                                  false:
+  ///    Foo::Foo() : a(a), b(b) {}             Foo::Foo() : a(a),b(b) {}
+  /// \endcode
+  /// \version 22
+  bool SpaceAfterCtorInitializerComma;
+
   /// If ``false``, spaces will be removed before inheritance colon.
   /// \code
   ///    true:                                  false:
@@ -5909,6 +5925,10 @@ struct FormatStyle {
            SpaceBeforeCpp11BracedList == R.SpaceBeforeCpp11BracedList &&
            SpaceBeforeCtorInitializerColon ==
                R.SpaceBeforeCtorInitializerColon &&
+           SpaceAfterCtorInitializerColon ==
+               R.SpaceAfterCtorInitializerColon &&
+           SpaceAfterCtorInitializerComma ==
+               R.SpaceAfterCtorInitializerComma &&
            SpaceBeforeInheritanceColon == R.SpaceBeforeInheritanceColon &&
            SpaceBeforeJsonColon == R.SpaceBeforeJsonColon &&
            SpaceBeforeParens == R.SpaceBeforeParens &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 2f67ec86b101a..dd05f27536b07 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1374,6 +1374,10 @@ template <> struct MappingTraits<FormatStyle> {
                    Style.SpaceBeforeCpp11BracedList);
     IO.mapOptional("SpaceBeforeCtorInitializerColon",
                    Style.SpaceBeforeCtorInitializerColon);
+    IO.mapOptional("SpaceAfterCtorInitializerColon",
+                   Style.SpaceAfterCtorInitializerColon);
+    IO.mapOptional("SpaceAfterCtorInitializerComma",
+                   Style.SpaceAfterCtorInitializerComma);
     IO.mapOptional("SpaceBeforeInheritanceColon",
                    Style.SpaceBeforeInheritanceColon);
     IO.mapOptional("SpaceBeforeJsonColon", Style.SpaceBeforeJsonColon);
@@ -1879,6 +1883,8 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.SpaceBeforeCaseColon = false;
   LLVMStyle.SpaceBeforeCpp11BracedList = false;
   LLVMStyle.SpaceBeforeCtorInitializerColon = true;
+  LLVMStyle.SpaceAfterCtorInitializerColon = true;
+  LLVMStyle.SpaceAfterCtorInitializerComma = true;
   LLVMStyle.SpaceBeforeInheritanceColon = true;
   LLVMStyle.SpaceBeforeJsonColon = false;
   LLVMStyle.SpaceBeforeParens = FormatStyle::SBPO_ControlStatements;
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 1b588435d6302..32dcc83ce8902 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5521,6 +5521,8 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
       // In an unexpanded macro call we only find the parentheses and commas
       // in a line; the commas and closing parenthesis do not require a space.
       (Left.Children.empty() || !Left.MacroParent)) {
+    if (Left.is(TT_CtorInitializerComma))
+      return Style.SpaceAfterCtorInitializerComma;
     return true;
   }
   if (Right.is(tok::comma))
@@ -5529,6 +5531,8 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
     return true;
   if (Right.is(TT_CtorInitializerColon))
     return Style.SpaceBeforeCtorInitializerColon;
+  if (Left.is(TT_CtorInitializerColon))
+    return Style.SpaceAfterCtorInitializerColon;
   if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon)
     return false;
   if (Right.is(TT_RangeBasedForLoopColon) &&
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index f270602f32604..fdb3fc49d2c9d 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -220,6 +220,8 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
   CHECK_PARSE_BOOL(SpaceBeforeCaseColon);
   CHECK_PARSE_BOOL(SpaceBeforeCpp11BracedList);
   CHECK_PARSE_BOOL(SpaceBeforeCtorInitializerColon);
+  CHECK_PARSE_BOOL(SpaceAfterCtorInitializerColon);
+  CHECK_PARSE_BOOL(SpaceAfterCtorInitializerComma);
   CHECK_PARSE_BOOL(SpaceBeforeInheritanceColon);
   CHECK_PARSE_BOOL(SpaceBeforeJsonColon);
   CHECK_PARSE_BOOL(SpaceBeforeRangeBasedForLoopColon);
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index dfc21bcefad53..1a2aad62faba6 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -18043,6 +18043,12 @@ TEST_F(FormatTest, ConfigurableSpaceBeforeColon) {
   CtorInitializerStyle.SpaceBeforeCtorInitializerColon = false;
   verifyFormat("class Foo : public Bar {};", CtorInitializerStyle);
   verifyFormat("Foo::Foo(): foo(1) {}", CtorInitializerStyle);
+  CtorInitializerStyle.SpaceAfterCtorInitializerColon = false;
+  verifyFormat("Foo::Foo():foo(1) {}", CtorInitializerStyle);
+  CtorInitializerStyle.SpaceAfterCtorInitializerComma = false;
+  verifyFormat("Foo::Foo():foo(1),bar(2) {}", CtorInitializerStyle);
+  CtorInitializerStyle.SpaceAfterCtorInitializerColon = true;
+  CtorInitializerStyle.SpaceAfterCtorInitializerComma = true;
   verifyFormat("for (auto a : b) {\n}", CtorInitializerStyle);
   verifyFormat("int x = a ? b : c;", CtorInitializerStyle);
   verifyFormat("{\n"

>From 3864745d657c845ea13ed2772ae9cc07ee264934 Mon Sep 17 00:00:00 2001
From: niXman <[email protected]>
Date: Wed, 8 Apr 2026 11:28:28 +0300
Subject: [PATCH 2/5] fix for prev commit

---
 clang/docs/ClangFormatStyleOptions.rst | 40 +++++++++++++-------------
 clang/include/clang/Format/Format.h    |  4 +--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 8af048b254fa6..b89bb871362da 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -6711,6 +6711,26 @@ the configuration (without a prefix: ``Auto``).
      true:                                  false:
      (int) i;                       vs.     (int)i;
 
+.. _SpaceAfterCtorInitializerColon:
+
+**SpaceAfterCtorInitializerColon** (``Boolean``) :versionbadge:`clang-format 
23` :ref:`¶ <SpaceAfterCtorInitializerColon>`
+  If ``false``, spaces will be removed after constructor initializer colon.
+
+  .. code-block:: c++
+
+     true:                                  false:
+     Foo::Foo() : a(a) {}                   Foo::Foo() :a(a) {}
+
+.. _SpaceAfterCtorInitializerComma:
+
+**SpaceAfterCtorInitializerComma** (``Boolean``) :versionbadge:`clang-format 
23` :ref:`¶ <SpaceAfterCtorInitializerComma>`
+  If ``false``, spaces will be removed after constructor initializer comma.
+
+  .. code-block:: c++
+
+     true:                                  false:
+     Foo::Foo() : a(a), b(b) {}             Foo::Foo() : a(a),b(b) {}
+
 .. _SpaceAfterLogicalNot:
 
 **SpaceAfterLogicalNot** (``Boolean``) :versionbadge:`clang-format 9` :ref:`¶ 
<SpaceAfterLogicalNot>`
@@ -6851,26 +6871,6 @@ the configuration (without a prefix: ``Auto``).
      true:                                  false:
      class Foo : Bar {}             vs.     class Foo: Bar {}
 
-.. _SpaceAfterCtorInitializerColon:
-
-**SpaceAfterCtorInitializerColon** (``Boolean``) :versionbadge:`clang-format 
22` :ref:`¶ <SpaceAfterCtorInitializerColon>`
-  If ``false``, spaces will be removed after constructor initializer colon.
-
-  .. code-block:: c++
-
-     true:                                  false:
-     Foo::Foo() : a(a) {}                   Foo::Foo() :a(a) {}
-
-.. _SpaceAfterCtorInitializerComma:
-
-**SpaceAfterCtorInitializerComma** (``Boolean``) :versionbadge:`clang-format 
22` :ref:`¶ <SpaceAfterCtorInitializerComma>`
-  If ``false``, spaces will be removed after constructor initializer comma.
-
-  .. code-block:: c++
-
-     true:                                  false:
-     Foo::Foo() : a(a), b(b) {}             Foo::Foo() : a(a),b(b) {}
-
 .. _SpaceBeforeJsonColon:
 
 **SpaceBeforeJsonColon** (``Boolean``) :versionbadge:`clang-format 17` :ref:`¶ 
<SpaceBeforeJsonColon>`
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index f69ea31b325ce..5f02a2c7cffd2 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -5126,7 +5126,7 @@ struct FormatStyle {
   ///    true:                                  false:
   ///    Foo::Foo() : a(a) {}                   Foo::Foo() :a(a) {}
   /// \endcode
-  /// \version 22
+  /// \version 23
   bool SpaceAfterCtorInitializerColon;
 
   /// If ``false``, spaces will be removed after constructor initializer comma.
@@ -5134,7 +5134,7 @@ struct FormatStyle {
   ///    true:                                  false:
   ///    Foo::Foo() : a(a), b(b) {}             Foo::Foo() : a(a),b(b) {}
   /// \endcode
-  /// \version 22
+  /// \version 23
   bool SpaceAfterCtorInitializerComma;
   /// If ``false``, spaces will be removed before enum underlying type colon.
   /// \code

>From ea8a7c48da49ec4fcea124f6a099e5c807376220 Mon Sep 17 00:00:00 2001
From: niXman <[email protected]>
Date: Wed, 8 Apr 2026 11:42:23 +0300
Subject: [PATCH 3/5] fix for prev commit

---
 clang/lib/Format/TokenAnnotator.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 58d7665d2b735..0671957579b21 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5537,12 +5537,15 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
       Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) {
     return true;
   }
+  if (Left.is(tok::comma) && Left.is(TT_CtorInitializerComma) &&
+      Right.isNot(TT_OverloadedOperatorLParen) &&
+      (Left.Children.empty() || !Left.MacroParent)) {
+    return Style.SpaceAfterCtorInitializerComma;
+  }
   if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) &&
       // In an unexpanded macro call we only find the parentheses and commas
       // in a line; the commas and closing parenthesis do not require a space.
       (Left.Children.empty() || !Left.MacroParent)) {
-    if (Left.is(TT_CtorInitializerComma))
-      return Style.SpaceAfterCtorInitializerComma;
     return true;
   }
   if (Right.is(tok::comma))
@@ -5551,7 +5554,7 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
     return true;
   if (Right.is(TT_CtorInitializerColon))
     return Style.SpaceBeforeCtorInitializerColon;
-  if (Left.is(TT_CtorInitializerColon))
+  if (Right.Previous->is(TT_CtorInitializerColon))
     return Style.SpaceAfterCtorInitializerColon;
   if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon)
     return false;

>From 213842c5b1755c9cbfdbf56dd3f78021ee47f3b9 Mon Sep 17 00:00:00 2001
From: niXman <[email protected]>
Date: Wed, 8 Apr 2026 22:26:16 +0300
Subject: [PATCH 4/5] fix for prev commit

---
 clang/include/clang/Format/Format.h        | 37 +++++++++++-----------
 clang/lib/Format/Format.cpp                | 12 +++----
 clang/lib/Format/TokenAnnotator.cpp        |  5 +--
 clang/unittests/Format/ConfigParseTest.cpp |  8 ++---
 4 files changed, 29 insertions(+), 33 deletions(-)

diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 5f02a2c7cffd2..77d22130c7231 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -5024,6 +5024,22 @@ struct FormatStyle {
   /// \version 3.5
   bool SpaceAfterCStyleCast;
 
+  /// If ``false``, spaces will be removed after constructor initializer colon.
+  /// \code
+  ///    true:                                  false:
+  ///    Foo::Foo() : a(a) {}                   Foo::Foo() :a(a) {}
+  /// \endcode
+  /// \version 23
+  bool SpaceAfterCtorInitializerColon;
+
+  /// If ``false``, spaces will be removed after constructor initializer comma.
+  /// \code
+  ///    true:                                  false:
+  ///    Foo::Foo() : a(a), b(b) {}             Foo::Foo() : a(a),b(b) {}
+  /// \endcode
+  /// \version 23
+  bool SpaceAfterCtorInitializerComma;
+
   /// If ``true``, a space is inserted after the logical not operator (``!``).
   /// \code
   ///    true:                                  false:
@@ -5121,21 +5137,6 @@ struct FormatStyle {
   /// \version 7
   bool SpaceBeforeCtorInitializerColon;
 
-  /// If ``false``, spaces will be removed after constructor initializer colon.
-  /// \code
-  ///    true:                                  false:
-  ///    Foo::Foo() : a(a) {}                   Foo::Foo() :a(a) {}
-  /// \endcode
-  /// \version 23
-  bool SpaceAfterCtorInitializerColon;
-
-  /// If ``false``, spaces will be removed after constructor initializer comma.
-  /// \code
-  ///    true:                                  false:
-  ///    Foo::Foo() : a(a), b(b) {}             Foo::Foo() : a(a),b(b) {}
-  /// \endcode
-  /// \version 23
-  bool SpaceAfterCtorInitializerComma;
   /// If ``false``, spaces will be removed before enum underlying type colon.
   /// \code
   ///    true:                                  false:
@@ -6091,6 +6092,8 @@ struct FormatStyle {
            SortIncludes == R.SortIncludes &&
            SortJavaStaticImport == R.SortJavaStaticImport &&
            SpaceAfterCStyleCast == R.SpaceAfterCStyleCast &&
+           SpaceAfterCtorInitializerColon == R.SpaceAfterCtorInitializerColon 
&&
+           SpaceAfterCtorInitializerComma == R.SpaceAfterCtorInitializerComma 
&&
            SpaceAfterLogicalNot == R.SpaceAfterLogicalNot &&
            SpaceAfterOperatorKeyword == R.SpaceAfterOperatorKeyword &&
            SpaceAfterTemplateKeyword == R.SpaceAfterTemplateKeyword &&
@@ -6099,10 +6102,6 @@ struct FormatStyle {
            SpaceBeforeCpp11BracedList == R.SpaceBeforeCpp11BracedList &&
            SpaceBeforeCtorInitializerColon ==
                R.SpaceBeforeCtorInitializerColon &&
-           SpaceAfterCtorInitializerColon ==
-               R.SpaceAfterCtorInitializerColon &&
-           SpaceAfterCtorInitializerComma ==
-               R.SpaceAfterCtorInitializerComma &&
            SpaceBeforeInheritanceColon == R.SpaceBeforeInheritanceColon &&
            SpaceBeforeJsonColon == R.SpaceBeforeJsonColon &&
            SpaceBeforeParens == R.SpaceBeforeParens &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 43354409f1b74..647a6d7fd18d6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1384,6 +1384,10 @@ template <> struct MappingTraits<FormatStyle> {
     IO.mapOptional("SortJavaStaticImport", Style.SortJavaStaticImport);
     IO.mapOptional("SortUsingDeclarations", Style.SortUsingDeclarations);
     IO.mapOptional("SpaceAfterCStyleCast", Style.SpaceAfterCStyleCast);
+    IO.mapOptional("SpaceAfterCtorInitializerColon",
+                   Style.SpaceAfterCtorInitializerColon);
+    IO.mapOptional("SpaceAfterCtorInitializerComma",
+                   Style.SpaceAfterCtorInitializerComma);
     IO.mapOptional("SpaceAfterLogicalNot", Style.SpaceAfterLogicalNot);
     IO.mapOptional("SpaceAfterOperatorKeyword",
                    Style.SpaceAfterOperatorKeyword);
@@ -1398,10 +1402,6 @@ template <> struct MappingTraits<FormatStyle> {
                    Style.SpaceBeforeCpp11BracedList);
     IO.mapOptional("SpaceBeforeCtorInitializerColon",
                    Style.SpaceBeforeCtorInitializerColon);
-    IO.mapOptional("SpaceAfterCtorInitializerColon",
-                   Style.SpaceAfterCtorInitializerColon);
-    IO.mapOptional("SpaceAfterCtorInitializerComma",
-                   Style.SpaceAfterCtorInitializerComma);
     IO.mapOptional("SpaceBeforeEnumUnderlyingTypeColon",
                    Style.SpaceBeforeEnumUnderlyingTypeColon);
     IO.mapOptional("SpaceBeforeInheritanceColon",
@@ -1916,6 +1916,8 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.SortJavaStaticImport = FormatStyle::SJSIO_Before;
   LLVMStyle.SortUsingDeclarations = FormatStyle::SUD_LexicographicNumeric;
   LLVMStyle.SpaceAfterCStyleCast = false;
+  LLVMStyle.SpaceAfterCtorInitializerColon = true;
+  LLVMStyle.SpaceAfterCtorInitializerComma = true;
   LLVMStyle.SpaceAfterLogicalNot = false;
   LLVMStyle.SpaceAfterOperatorKeyword = false;
   LLVMStyle.SpaceAfterTemplateKeyword = true;
@@ -1924,8 +1926,6 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.SpaceBeforeCaseColon = false;
   LLVMStyle.SpaceBeforeCpp11BracedList = false;
   LLVMStyle.SpaceBeforeCtorInitializerColon = true;
-  LLVMStyle.SpaceAfterCtorInitializerColon = true;
-  LLVMStyle.SpaceAfterCtorInitializerComma = true;
   LLVMStyle.SpaceBeforeEnumUnderlyingTypeColon = true;
   LLVMStyle.SpaceBeforeInheritanceColon = true;
   LLVMStyle.SpaceBeforeJsonColon = false;
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 0671957579b21..0fb19533c66c4 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5537,11 +5537,8 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
       Left.isOneOf(TT_TrailingReturnArrow, TT_LambdaArrow)) {
     return true;
   }
-  if (Left.is(tok::comma) && Left.is(TT_CtorInitializerComma) &&
-      Right.isNot(TT_OverloadedOperatorLParen) &&
-      (Left.Children.empty() || !Left.MacroParent)) {
+  if (Left.is(TT_CtorInitializerComma))
     return Style.SpaceAfterCtorInitializerComma;
-  }
   if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) &&
       // In an unexpanded macro call we only find the parentheses and commas
       // in a line; the commas and closing parenthesis do not require a space.
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index d0f63b2f7f070..515db3a8e6e33 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -212,15 +212,15 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
   CHECK_PARSE_BOOL(SpacesInSquareBrackets);
   CHECK_PARSE_BOOL(SpacesInContainerLiterals);
   CHECK_PARSE_BOOL(SpaceAfterCStyleCast);
-  CHECK_PARSE_BOOL(SpaceAfterTemplateKeyword);
-  CHECK_PARSE_BOOL(SpaceAfterOperatorKeyword);
+  CHECK_PARSE_BOOL(SpaceAfterCtorInitializerColon);
+  CHECK_PARSE_BOOL(SpaceAfterCtorInitializerComma);
   CHECK_PARSE_BOOL(SpaceAfterLogicalNot);
+  CHECK_PARSE_BOOL(SpaceAfterOperatorKeyword);
+  CHECK_PARSE_BOOL(SpaceAfterTemplateKeyword);
   CHECK_PARSE_BOOL(SpaceBeforeAssignmentOperators);
   CHECK_PARSE_BOOL(SpaceBeforeCaseColon);
   CHECK_PARSE_BOOL(SpaceBeforeCpp11BracedList);
   CHECK_PARSE_BOOL(SpaceBeforeCtorInitializerColon);
-  CHECK_PARSE_BOOL(SpaceAfterCtorInitializerColon);
-  CHECK_PARSE_BOOL(SpaceAfterCtorInitializerComma);
   CHECK_PARSE_BOOL(SpaceBeforeEnumUnderlyingTypeColon);
   CHECK_PARSE_BOOL(SpaceBeforeInheritanceColon);
   CHECK_PARSE_BOOL(SpaceBeforeJsonColon);

>From 1bdaf0a7a79b0ec33519a7c7828dcc1b387c105a Mon Sep 17 00:00:00 2001
From: niXman <[email protected]>
Date: Wed, 8 Apr 2026 22:34:58 +0300
Subject: [PATCH 5/5] Right.Previous -> Left

---
 clang/lib/Format/TokenAnnotator.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 0fb19533c66c4..3b734c6cac633 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5539,6 +5539,8 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
   }
   if (Left.is(TT_CtorInitializerComma))
     return Style.SpaceAfterCtorInitializerComma;
+  if (Left.is(TT_CtorInitializerColon))
+    return Style.SpaceAfterCtorInitializerColon;
   if (Left.is(tok::comma) && Right.isNot(TT_OverloadedOperatorLParen) &&
       // In an unexpanded macro call we only find the parentheses and commas
       // in a line; the commas and closing parenthesis do not require a space.
@@ -5551,8 +5553,6 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
     return true;
   if (Right.is(TT_CtorInitializerColon))
     return Style.SpaceBeforeCtorInitializerColon;
-  if (Right.Previous->is(TT_CtorInitializerColon))
-    return Style.SpaceAfterCtorInitializerColon;
   if (Right.is(TT_InheritanceColon) && !Style.SpaceBeforeInheritanceColon)
     return false;
   if (Right.is(TT_EnumUnderlyingTypeColon) &&

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to