[clang] [clang-format] Remove special handling of comments after brace/paren (PR #71672)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 17 12:54:47 PDT 2025


================
@@ -4699,6 +4699,113 @@ TEST_F(FormatTestComments, SplitCommentIntroducers) {
                    getLLVMStyleWithColumns(10)));
 }
 
+TEST_F(FormatTestComments, LineCommentsOnStartOfFunctionCall) {
+  auto Style = getLLVMStyle();
+
+  EXPECT_EQ(Style.Cpp11BracedListStyle, FormatStyle::CBLSS_ToBeNamed);
+
+  verifyFormat("T foo( // Comment\n"
+               "    arg);",
+               Style);
+
+  verifyFormat("T bar{// Comment\n"
+               "      arg};",
+               Style);
+
+  verifyFormat("T baz({// Comment\n"
+               "       arg});",
+               Style);
+
+  verifyFormat("T baz{{// Comment\n"
+               "       arg}};",
+               Style);
+
+  verifyFormat("T b0z(f( // Comment\n"
+               "    arg));",
+               Style);
+
+  verifyFormat("T b0z(F{// Comment\n"
+               "        arg});",
+               Style);
+
+  verifyFormat("func( // Comment\n"
+               "    arg);",
+               Style);
+
+  verifyFormat("func({// Comment\n"
+               "      arg});",
+               Style);
+
+  Style.Cpp11BracedListStyle = FormatStyle::CBLSS_FunctionCall;
+
+  verifyFormat("T foo( // Comment\n"
+               "    arg);",
+               Style);
+
+  verifyFormat("T bar{ // Comment\n"
+               "    arg};",
+               Style);
+
+  verifyFormat("T baz({ // Comment\n"
+               "    arg});",
+               Style);
+
+  verifyFormat("T baz{{ // Comment\n"
+               "        arg}};",
----------------
HazardyKnusperkeks wrote:

Now it is.

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


More information about the cfe-commits mailing list