https://github.com/vkpatel186 updated 
https://github.com/llvm/llvm-project/pull/170579

>From 5961395d09a79c8bf06392eb388b3f41ec89ecc7 Mon Sep 17 00:00:00 2001
From: Vikas Patel <[email protected]>
Date: Thu, 4 Dec 2025 00:07:17 +0000
Subject: [PATCH 1/4] [clang-format] Add ObjCSpaceBeforeMethodDeclColon option
 to control space before Objective-C method return type

This patch introduces the ObjCSpaceBeforeMethodDeclColon style option, allowing 
users to add or remove a space between the '-'/'+' and the return type in 
Objective-C method declarations (e.g., '- (void)method' vs '-(void)method').

Includes documentation and unit tests.
---
 clang/docs/ClangFormatStyleOptions.rst |  6 ++++++
 clang/include/clang/Format/Format.h    |  8 +++++++-
 clang/lib/Format/Format.cpp            |  3 +++
 clang/lib/Format/TokenAnnotator.cpp    |  2 +-
 clang/unittests/Format/FormatTest.cpp  | 16 ++++++++++++++++
 5 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 4f81a084dd65b..dcd59a8820231 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5538,6 +5538,12 @@ the configuration (without a prefix: ``Auto``).
   Add a space after ``@property`` in Objective-C, i.e. use
   ``@property (readonly)`` instead of ``@property(readonly)``.
 
+.. _ObjCSpaceBeforeMethodDeclColon:
+
+**ObjCSpaceBeforeMethodDeclColon** (``Boolean``) :versionbadge:`clang-format 
23` :ref:`¶ <ObjCSpaceBeforeMethodDeclColon>`
+  Add or remove a space between the '-'/'+' and the return type in Objective-C 
method declarations,
+  i.e. use '- (void)method' instead of '-(void)method'.
+
 .. _ObjCSpaceBeforeProtocolList:
 
 **ObjCSpaceBeforeProtocolList** (``Boolean``) :versionbadge:`clang-format 3.7` 
:ref:`¶ <ObjCSpaceBeforeProtocolList>`
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index c7e57d47f9ed1..a0c7310f80ff4 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3936,6 +3936,11 @@ struct FormatStyle {
   /// \version 3.7
   bool ObjCSpaceAfterProperty;
 
+  /// Add or remove a space between the '-'/'+' and the return type in 
Objective-C method declarations,
+  /// i.e. use '- (void)method' instead of '-(void)method'.
+  /// \version 23
+  bool ObjCSpaceBeforeMethodDeclColon;
+
   /// Add a space in front of an Objective-C protocol list, i.e. use
   /// ``Foo <Protocol>`` instead of ``Foo<Protocol>``.
   /// \version 3.7
@@ -5845,7 +5850,8 @@ struct FormatStyle {
            VerilogBreakBetweenInstancePorts ==
                R.VerilogBreakBetweenInstancePorts &&
            WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros &&
-           WrapNamespaceBodyWithEmptyLines == 
R.WrapNamespaceBodyWithEmptyLines;
+           WrapNamespaceBodyWithEmptyLines == 
R.WrapNamespaceBodyWithEmptyLines &&
+           ObjCSpaceBeforeMethodDeclColon == R.ObjCSpaceBeforeMethodDeclColon;
   }
 
   std::optional<FormatStyle> GetLanguageStyle(LanguageKind Language) const;
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index f0e9aff2fd21a..db184da18cc99 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1353,6 +1353,8 @@ template <> struct MappingTraits<FormatStyle> {
                    Style.WhitespaceSensitiveMacros);
     IO.mapOptional("WrapNamespaceBodyWithEmptyLines",
                    Style.WrapNamespaceBodyWithEmptyLines);
+    IO.mapOptional("ObjCSpaceBeforeMethodDeclColon",
+                   Style.ObjCSpaceBeforeMethodDeclColon);
 
     // If AlwaysBreakAfterDefinitionReturnType was specified but
     // BreakAfterReturnType was not, initialize the latter from the former for
@@ -1788,6 +1790,7 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.ObjCBlockIndentWidth = 2;
   LLVMStyle.ObjCBreakBeforeNestedBlockParam = true;
   LLVMStyle.ObjCSpaceAfterProperty = false;
+  LLVMStyle.ObjCSpaceBeforeMethodDeclColon = true;
   LLVMStyle.ObjCSpaceBeforeProtocolList = true;
   LLVMStyle.PackConstructorInitializers = FormatStyle::PCIS_BinPack;
   LLVMStyle.PointerAlignment = FormatStyle::PAS_Right;
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 79cfa73001e54..af48d804b4518 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5437,7 +5437,7 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
     return Right.hasWhitespaceBefore();
   if (Line.Type == LT_ObjCMethodDecl) {
     if (Left.is(TT_ObjCMethodSpecifier))
-      return true;
+      return Style.ObjCSpaceBeforeMethodDeclColon;
     if (Left.is(tok::r_paren) && Left.isNot(TT_AttributeRParen) &&
         canBeObjCSelectorComponent(Right)) {
       // Don't space between ')' and <id> or ')' and 'new'. 'new' is not a
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 3ff784035dd44..bd98051872fcf 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -15623,6 +15623,22 @@ TEST_F(FormatTest, FormatForObjectiveCMethodDecls) {
   verifyGoogleFormat("- foo:(int)foo;");
 }
 
+TEST_F(FormatTest, SpaceBeforeObjCMethodDeclColon) {
+  FormatStyle Style = getLLVMStyle();
+  verifyFormat("- (void)method;", "-(void)method;", Style);
+  verifyFormat("+ (int)foo:(int)x;", "+       (int)        foo:(int)x;", 
Style);
+  verifyFormat("- foo;", "-foo;", Style);
+  verifyFormat("- foo:(int)f;", "-foo:(int)f;", Style);
+
+  Style.ObjCSpaceBeforeMethodDeclColon = false;
+  verifyFormat("-(void)method;", "-  (void)   method;", Style);
+  verifyFormat("+(int)foo:(int)x;", "+        (int)foo:(int)x;", Style);
+  verifyFormat("+(int)foo:(int)x;", "+ (int)foo:(int)x;", Style);
+
+  verifyFormat("-foo;", "- foo;", Style);
+  verifyFormat("-foo:(int)f;", "- foo:(int)f;", Style);
+}
+
 TEST_F(FormatTest, BreaksStringLiterals) {
   // FIXME: unstable test case
   EXPECT_EQ("\"some text \"\n"

>From f10f688d37adf4afab5cc226e374a156cabba9b9 Mon Sep 17 00:00:00 2001
From: Vikas Patel <[email protected]>
Date: Thu, 4 Dec 2025 23:31:05 +0000
Subject: [PATCH 2/4] Fix review comments

---
 clang/docs/ClangFormatStyleOptions.rst | 12 +++++++++---
 clang/docs/ReleaseNotes.rst            |  2 ++
 clang/include/clang/Format/Format.h    | 15 ++++++++++-----
 clang/lib/Format/Format.cpp            |  4 ++--
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index dcd59a8820231..1bd34fc7e3ba2 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5540,9 +5540,15 @@ the configuration (without a prefix: ``Auto``).
 
 .. _ObjCSpaceBeforeMethodDeclColon:
 
-**ObjCSpaceBeforeMethodDeclColon** (``Boolean``) :versionbadge:`clang-format 
23` :ref:`¶ <ObjCSpaceBeforeMethodDeclColon>`
-  Add or remove a space between the '-'/'+' and the return type in Objective-C 
method declarations,
-  i.e. use '- (void)method' instead of '-(void)method'.
+**ObjCSpaceBeforeMethodDeclColon** (``Boolean``) :versionbadge:`clang-format 
22` :ref:`¶ <ObjCSpaceBeforeMethodDeclColon>`
+  Add or remove a space between the '-'/'+' and the return type in
+  Objective-C method declarations. i.e
+
+  .. code-block:: objc
+
+     false:                      true:
+
+     -(void)method      vs.      - (void)method
 
 .. _ObjCSpaceBeforeProtocolList:
 
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 654a8e48cd104..6cbb096c411c3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -725,6 +725,8 @@ clang-format
 - Rename ``(Binary|Decimal|Hex)MinDigits`` to ``...MinDigitsInsert`` and  add
   ``(Binary|Decimal|Hex)MaxDigitsSeparator`` suboptions to
   ``IntegerLiteralSeparator``.
+- Add ``ObjCSpaceBeforeMethodDeclColon`` option to control space between the 
+  '-'/'+' and the return type in Objective-C method declarations
 
 libclang
 --------
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index a0c7310f80ff4..b1042b977645f 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3936,9 +3936,14 @@ struct FormatStyle {
   /// \version 3.7
   bool ObjCSpaceAfterProperty;
 
-  /// Add or remove a space between the '-'/'+' and the return type in 
Objective-C method declarations,
-  /// i.e. use '- (void)method' instead of '-(void)method'.
-  /// \version 23
+  /// Add or remove a space between the '-'/'+' and the return type in
+  /// Objective-C method declarations. i.e
+  /// \code{.objc}
+  ///    false:                      true:
+  ///
+  ///    -(void)method      vs.      - (void)method
+  /// \endcode
+  /// \version 22
   bool ObjCSpaceBeforeMethodDeclColon;
 
   /// Add a space in front of an Objective-C protocol list, i.e. use
@@ -5778,6 +5783,7 @@ struct FormatStyle {
            ObjCPropertyAttributeOrder == R.ObjCPropertyAttributeOrder &&
            ObjCSpaceAfterProperty == R.ObjCSpaceAfterProperty &&
            ObjCSpaceBeforeProtocolList == R.ObjCSpaceBeforeProtocolList &&
+           ObjCSpaceBeforeMethodDeclColon == R.ObjCSpaceBeforeMethodDeclColon 
&&
            OneLineFormatOffRegex == R.OneLineFormatOffRegex &&
            PackConstructorInitializers == R.PackConstructorInitializers &&
            PenaltyBreakAssignment == R.PenaltyBreakAssignment &&
@@ -5850,8 +5856,7 @@ struct FormatStyle {
            VerilogBreakBetweenInstancePorts ==
                R.VerilogBreakBetweenInstancePorts &&
            WhitespaceSensitiveMacros == R.WhitespaceSensitiveMacros &&
-           WrapNamespaceBodyWithEmptyLines == 
R.WrapNamespaceBodyWithEmptyLines &&
-           ObjCSpaceBeforeMethodDeclColon == R.ObjCSpaceBeforeMethodDeclColon;
+           WrapNamespaceBodyWithEmptyLines == 
R.WrapNamespaceBodyWithEmptyLines;
   }
 
   std::optional<FormatStyle> GetLanguageStyle(LanguageKind Language) const;
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index db184da18cc99..04ea6b094cbcd 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1246,6 +1246,8 @@ template <> struct MappingTraits<FormatStyle> {
     IO.mapOptional("ObjCPropertyAttributeOrder",
                    Style.ObjCPropertyAttributeOrder);
     IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty);
+    IO.mapOptional("ObjCSpaceBeforeMethodDeclColon",
+                   Style.ObjCSpaceBeforeMethodDeclColon);
     IO.mapOptional("ObjCSpaceBeforeProtocolList",
                    Style.ObjCSpaceBeforeProtocolList);
     IO.mapOptional("OneLineFormatOffRegex", Style.OneLineFormatOffRegex);
@@ -1353,8 +1355,6 @@ template <> struct MappingTraits<FormatStyle> {
                    Style.WhitespaceSensitiveMacros);
     IO.mapOptional("WrapNamespaceBodyWithEmptyLines",
                    Style.WrapNamespaceBodyWithEmptyLines);
-    IO.mapOptional("ObjCSpaceBeforeMethodDeclColon",
-                   Style.ObjCSpaceBeforeMethodDeclColon);
 
     // If AlwaysBreakAfterDefinitionReturnType was specified but
     // BreakAfterReturnType was not, initialize the latter from the former for

>From 9818413a44fa639ce56c8594077e32db516e2ae5 Mon Sep 17 00:00:00 2001
From: Vikas Patel <[email protected]>
Date: Sat, 6 Dec 2025 22:56:06 +0000
Subject: [PATCH 3/4] Fix Review comments, make new property order alphabetical

---
 clang/include/clang/Format/Format.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index b1042b977645f..240a00e3c27d4 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -5782,8 +5782,8 @@ struct FormatStyle {
                R.ObjCBreakBeforeNestedBlockParam &&
            ObjCPropertyAttributeOrder == R.ObjCPropertyAttributeOrder &&
            ObjCSpaceAfterProperty == R.ObjCSpaceAfterProperty &&
-           ObjCSpaceBeforeProtocolList == R.ObjCSpaceBeforeProtocolList &&
            ObjCSpaceBeforeMethodDeclColon == R.ObjCSpaceBeforeMethodDeclColon 
&&
+           ObjCSpaceBeforeProtocolList == R.ObjCSpaceBeforeProtocolList &&
            OneLineFormatOffRegex == R.OneLineFormatOffRegex &&
            PackConstructorInitializers == R.PackConstructorInitializers &&
            PenaltyBreakAssignment == R.PenaltyBreakAssignment &&

>From 22f31b5da9722f273726544ed7acdb3ba19712d5 Mon Sep 17 00:00:00 2001
From: Vikas Patel <[email protected]>
Date: Tue, 23 Dec 2025 23:49:52 +0000
Subject: [PATCH 4/4] Update property name and unit test

---
 clang/docs/ClangFormatStyleOptions.rst     | 16 ++++++++--------
 clang/docs/ReleaseNotes.rst                |  2 +-
 clang/include/clang/Format/Format.h        | 15 ++++++++-------
 clang/lib/Format/Format.cpp                |  6 +++---
 clang/lib/Format/TokenAnnotator.cpp        |  2 +-
 clang/unittests/Format/ConfigParseTest.cpp |  1 +
 clang/unittests/Format/FormatTest.cpp      | 18 +++++-------------
 7 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/clang/docs/ClangFormatStyleOptions.rst 
b/clang/docs/ClangFormatStyleOptions.rst
index 1bd34fc7e3ba2..7912c9c41554f 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -5532,15 +5532,9 @@ the configuration (without a prefix: ``Auto``).
         nullable, nonnull, null_resettable, null_unspecified
     ]
 
-.. _ObjCSpaceAfterProperty:
-
-**ObjCSpaceAfterProperty** (``Boolean``) :versionbadge:`clang-format 3.7` 
:ref:`¶ <ObjCSpaceAfterProperty>`
-  Add a space after ``@property`` in Objective-C, i.e. use
-  ``@property (readonly)`` instead of ``@property(readonly)``.
-
-.. _ObjCSpaceBeforeMethodDeclColon:
+.. _ObjCSpaceAfterMethodDeclarationPrefix:
 
-**ObjCSpaceBeforeMethodDeclColon** (``Boolean``) :versionbadge:`clang-format 
22` :ref:`¶ <ObjCSpaceBeforeMethodDeclColon>`
+**ObjCSpaceAfterMethodDeclarationPrefix** (``Boolean``) 
:versionbadge:`clang-format 22` :ref:`¶ <ObjCSpaceAfterMethodDeclarationPrefix>`
   Add or remove a space between the '-'/'+' and the return type in
   Objective-C method declarations. i.e
 
@@ -5550,6 +5544,12 @@ the configuration (without a prefix: ``Auto``).
 
      -(void)method      vs.      - (void)method
 
+.. _ObjCSpaceAfterProperty:
+
+**ObjCSpaceAfterProperty** (``Boolean``) :versionbadge:`clang-format 3.7` 
:ref:`¶ <ObjCSpaceAfterProperty>`
+  Add a space after ``@property`` in Objective-C, i.e. use
+  ``@property (readonly)`` instead of ``@property(readonly)``.
+
 .. _ObjCSpaceBeforeProtocolList:
 
 **ObjCSpaceBeforeProtocolList** (``Boolean``) :versionbadge:`clang-format 3.7` 
:ref:`¶ <ObjCSpaceBeforeProtocolList>`
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index aa27fabac4254..1cb1172057020 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -793,7 +793,7 @@ clang-format
 - Rename ``(Binary|Decimal|Hex)MinDigits`` to ``...MinDigitsInsert`` and  add
   ``(Binary|Decimal|Hex)MaxDigitsSeparator`` suboptions to
   ``IntegerLiteralSeparator``.
-- Add ``ObjCSpaceBeforeMethodDeclColon`` option to control space between the 
+- Add ``ObjCSpaceAfterMethodDeclarationPrefix`` option to control space 
between the 
   '-'/'+' and the return type in Objective-C method declarations
 
 libclang
diff --git a/clang/include/clang/Format/Format.h 
b/clang/include/clang/Format/Format.h
index 240a00e3c27d4..93c9c8159fa0a 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -3931,11 +3931,6 @@ struct FormatStyle {
   /// \version 18
   std::vector<std::string> ObjCPropertyAttributeOrder;
 
-  /// Add a space after ``@property`` in Objective-C, i.e. use
-  /// ``@property (readonly)`` instead of ``@property(readonly)``.
-  /// \version 3.7
-  bool ObjCSpaceAfterProperty;
-
   /// Add or remove a space between the '-'/'+' and the return type in
   /// Objective-C method declarations. i.e
   /// \code{.objc}
@@ -3944,7 +3939,12 @@ struct FormatStyle {
   ///    -(void)method      vs.      - (void)method
   /// \endcode
   /// \version 22
-  bool ObjCSpaceBeforeMethodDeclColon;
+  bool ObjCSpaceAfterMethodDeclarationPrefix;
+
+  /// Add a space after ``@property`` in Objective-C, i.e. use
+  /// ``@property (readonly)`` instead of ``@property(readonly)``.
+  /// \version 3.7
+  bool ObjCSpaceAfterProperty;
 
   /// Add a space in front of an Objective-C protocol list, i.e. use
   /// ``Foo <Protocol>`` instead of ``Foo<Protocol>``.
@@ -5781,8 +5781,9 @@ struct FormatStyle {
            ObjCBreakBeforeNestedBlockParam ==
                R.ObjCBreakBeforeNestedBlockParam &&
            ObjCPropertyAttributeOrder == R.ObjCPropertyAttributeOrder &&
+           ObjCSpaceAfterMethodDeclarationPrefix ==
+               R.ObjCSpaceAfterMethodDeclarationPrefix &&
            ObjCSpaceAfterProperty == R.ObjCSpaceAfterProperty &&
-           ObjCSpaceBeforeMethodDeclColon == R.ObjCSpaceBeforeMethodDeclColon 
&&
            ObjCSpaceBeforeProtocolList == R.ObjCSpaceBeforeProtocolList &&
            OneLineFormatOffRegex == R.OneLineFormatOffRegex &&
            PackConstructorInitializers == R.PackConstructorInitializers &&
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 04ea6b094cbcd..1e68de531791f 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1245,9 +1245,9 @@ template <> struct MappingTraits<FormatStyle> {
                    Style.ObjCBreakBeforeNestedBlockParam);
     IO.mapOptional("ObjCPropertyAttributeOrder",
                    Style.ObjCPropertyAttributeOrder);
+    IO.mapOptional("ObjCSpaceAfterMethodDeclarationPrefix",
+                   Style.ObjCSpaceAfterMethodDeclarationPrefix);
     IO.mapOptional("ObjCSpaceAfterProperty", Style.ObjCSpaceAfterProperty);
-    IO.mapOptional("ObjCSpaceBeforeMethodDeclColon",
-                   Style.ObjCSpaceBeforeMethodDeclColon);
     IO.mapOptional("ObjCSpaceBeforeProtocolList",
                    Style.ObjCSpaceBeforeProtocolList);
     IO.mapOptional("OneLineFormatOffRegex", Style.OneLineFormatOffRegex);
@@ -1789,8 +1789,8 @@ FormatStyle getLLVMStyle(FormatStyle::LanguageKind 
Language) {
   LLVMStyle.ObjCBinPackProtocolList = FormatStyle::BPS_Auto;
   LLVMStyle.ObjCBlockIndentWidth = 2;
   LLVMStyle.ObjCBreakBeforeNestedBlockParam = true;
+  LLVMStyle.ObjCSpaceAfterMethodDeclarationPrefix = true;
   LLVMStyle.ObjCSpaceAfterProperty = false;
-  LLVMStyle.ObjCSpaceBeforeMethodDeclColon = true;
   LLVMStyle.ObjCSpaceBeforeProtocolList = true;
   LLVMStyle.PackConstructorInitializers = FormatStyle::PCIS_BinPack;
   LLVMStyle.PointerAlignment = FormatStyle::PAS_Right;
diff --git a/clang/lib/Format/TokenAnnotator.cpp 
b/clang/lib/Format/TokenAnnotator.cpp
index 491b68407b9c2..d0c7e7d0e1fb2 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -5494,7 +5494,7 @@ bool TokenAnnotator::spaceRequiredBefore(const 
AnnotatedLine &Line,
     return Right.hasWhitespaceBefore();
   if (Line.Type == LT_ObjCMethodDecl) {
     if (Left.is(TT_ObjCMethodSpecifier))
-      return Style.ObjCSpaceBeforeMethodDeclColon;
+      return Style.ObjCSpaceAfterMethodDeclarationPrefix;
     if (Left.is(tok::r_paren) && Left.isNot(TT_AttributeRParen) &&
         canBeObjCSelectorComponent(Right)) {
       // Don't space between ')' and <id> or ')' and 'new'. 'new' is not a
diff --git a/clang/unittests/Format/ConfigParseTest.cpp 
b/clang/unittests/Format/ConfigParseTest.cpp
index fec1c48c448d2..0a116b770f52a 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -203,6 +203,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
   CHECK_PARSE_BOOL_FIELD(KeepEmptyLines.AtStartOfBlock,
                          "KeepEmptyLinesAtTheStartOfBlocks");
   CHECK_PARSE_BOOL(KeepFormFeed);
+  CHECK_PARSE_BOOL(ObjCSpaceAfterMethodDeclarationPrefix);
   CHECK_PARSE_BOOL(ObjCSpaceAfterProperty);
   CHECK_PARSE_BOOL(ObjCSpaceBeforeProtocolList);
   CHECK_PARSE_BOOL(RemoveBracesLLVM);
diff --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index 6539ec77cce2f..ded4561909422 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -15624,19 +15624,11 @@ TEST_F(FormatTest, FormatForObjectiveCMethodDecls) {
 }
 
 TEST_F(FormatTest, SpaceBeforeObjCMethodDeclColon) {
-  FormatStyle Style = getLLVMStyle();
-  verifyFormat("- (void)method;", "-(void)method;", Style);
-  verifyFormat("+ (int)foo:(int)x;", "+       (int)        foo:(int)x;", 
Style);
-  verifyFormat("- foo;", "-foo;", Style);
-  verifyFormat("- foo:(int)f;", "-foo:(int)f;", Style);
-
-  Style.ObjCSpaceBeforeMethodDeclColon = false;
-  verifyFormat("-(void)method;", "-  (void)   method;", Style);
-  verifyFormat("+(int)foo:(int)x;", "+        (int)foo:(int)x;", Style);
-  verifyFormat("+(int)foo:(int)x;", "+ (int)foo:(int)x;", Style);
-
-  verifyFormat("-foo;", "- foo;", Style);
-  verifyFormat("-foo:(int)f;", "- foo:(int)f;", Style);
+  auto Style = getLLVMStyle();
+  EXPECT_TRUE(Style.ObjCSpaceAfterMethodDeclarationPrefix);
+  verifyFormat("- (void)method;", Style);
+  Style.ObjCSpaceAfterMethodDeclarationPrefix = false;
+  verifyFormat("-(void)method;", Style);
 }
 
 TEST_F(FormatTest, BreaksStringLiterals) {

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

Reply via email to