<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - One constructor initializer per line"
   href="https://bugs.llvm.org/show_bug.cgi?id=50549">50549</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>One constructor initializer per line
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Formatter
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nikolai.hlubek@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>djasper@google.com, klimek@google.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>It is not possible with clang format to always have one constructor initializer
per line no matter what. 

ConstructorInitializerAllOnOneLineOrOnePerLine only works in cases when the
line length is exceeded. This is ok if you have a line length of 80 characters.
If you have 160 characters (because of doxygen etc.) it looks horrible.

The first attempt to fix this goes back to 2015 and this review has been
getting comments ever since:
<a href="https://reviews.llvm.org/D14484#2788953">https://reviews.llvm.org/D14484#2788953</a>
There is also a stackoverflow question about this:
<a href="https://stackoverflow.com/questions/56811537/clang-format-how-to-keep-each-element-of-constructors-initializer-list-on-a-se">https://stackoverflow.com/questions/56811537/clang-format-how-to-keep-each-element-of-constructors-initializer-list-on-a-se</a>


Unit test for  unittests/Format/FormatTest.cpp
that explains in code what I am tring to achieve and what does not work:
TEST_F(FormatTest, ConstructorInitializerAllOnOneLineOrOnePerLine_AlwaysBreak)
{
  FormatStyle Style = getLLVMStyle();
  Style.ColumnLimit = 160;
  Style.BinPackParameters = false;
  Style.BreakConstructorInitializers = FormatStyle::BCIS_AfterColon;
  Style.AllowAllConstructorInitializersOnNextLine = false;
  Style.ConstructorInitializerAllOnOneLineOrOnePerLine = true;
  verifyFormat("Constructor() :\n"
               "    aaaaaaaaaaaaaaaaaa(a),\n"
               "    bbbbbbbbbbbbbbbbbbbbb(b) {}",
               Style);
}


In my opinion this is not difficult to fix and I already have a proof of
concept ready on github:
<a href="https://github.com/Nikolai-Hlubek/clang/tree/ConstructorInitializer_AlwaysBreakAfterColon">https://github.com/Nikolai-Hlubek/clang/tree/ConstructorInitializer_AlwaysBreakAfterColon</a>

It would really be nice to get this fixed.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>