================
@@ -925,7 +925,12 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState 
&State, bool DryRun,
                         TT_TableGenDAGArgOpenerToBreak) &&
       !(Current.MacroParent && Previous.MacroParent) &&
       (Current.isNot(TT_LineComment) ||
-       Previous.isOneOf(BK_BracedInit, TT_VerilogMultiLineListLParen)) &&
+       (Previous.is(BK_BracedInit) &&
+        (Style.Cpp11BracedListStyle != FormatStyle::BLS_FunctionCall ||
+         !Previous.Previous ||
+         Previous.Previous->isNoneOf(tok::identifier, tok::l_paren,
----------------
owenca wrote:

Dropping the conditions:
```diff
--- a/clang/lib/Format/ContinuationIndenter.cpp
+++ b/clang/lib/Format/ContinuationIndenter.cpp
@@ -926,10 +926,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState 
&State, bool DryRun,
       !(Current.MacroParent && Previous.MacroParent) &&
       (Current.isNot(TT_LineComment) ||
        (Previous.is(BK_BracedInit) &&
-        (Style.Cpp11BracedListStyle != FormatStyle::BLS_FunctionCall ||
-         !Previous.Previous ||
-         Previous.Previous->isNoneOf(tok::identifier, tok::l_paren,
-                                     BK_BracedInit))) ||
+        Style.Cpp11BracedListStyle != FormatStyle::BLS_FunctionCall) ||
        Previous.is(TT_VerilogMultiLineListLParen)) &&
       !IsInTemplateString(Current)) {
     CurrentState.Indent = State.Column + Spaces;
```
and adding back the redundant test cases from 
https://github.com/llvm/llvm-project/pull/71672#discussion_r2423385182 and 
https://github.com/llvm/llvm-project/pull/71672#discussion_r2423385357:
```diff
--- a/clang/unittests/Format/FormatTestComments.cpp
+++ b/clang/unittests/Format/FormatTestComments.cpp
@@ -4707,12 +4707,77 @@ TEST_F(FormatTestComments, 
LineCommentsOnStartOfFunctionCall) {
                "          value};",
                Style);
 
+  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::BLS_Block;
   verifyFormat("Type name{ // Comment\n"
                "           value\n"
                "};",
                Style);
 
+  verifyFormat("T foo( // Comment\n"
+               "    arg);",
+               Style);
+
+  verifyFormat("T bar{ // Comment\n"
+               "       arg\n"
+               "};",
+               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::BLS_FunctionCall;
   verifyFormat("Type name{ // Comment\n"
                "    value};",
```
wouldn't break any tests. So either the conditions were superfluous or we 
missed test cases for them.

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

Reply via email to