<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 - [clang-format] Don't force non-breaking macro calls"
   href="https://bugs.llvm.org/show_bug.cgi?id=40335">40335</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[clang-format] Don't force non-breaking macro calls
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>dennis.felsing@sap.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

Function calls and initialization lists can include line breaks in their
arguments and clang-format keeps them as they are. When using the EXPECT_THAT
and ElementsAre calls in gmock though clang-format rewrites all arguments to a
single line. Is it possible to make the behaviour of EXPECT_THAT(v,
ElementsAre(...)) more consistent with regular function calls so that the
elements stay on their own lines?

See the following example:

$ clang-format --version
clang-format version 9.0.0 (<a href="https://github.com/llvm-mirror/clang">https://github.com/llvm-mirror/clang</a>
7e968f8a6a2b7d07835493c04dd1989d46970599) (<a href="https://github.com/llvm-mirror/llvm">https://github.com/llvm-mirror/llvm</a>
0cb1621554afa8612836c4edfc890fe337320008)
$ cat .clang-format
Language: Cpp
BasedOnStyle: WebKit
Cpp11BracedListStyle: true
$ cat x.cpp
#include <vector>
#include <gmock/gmock.h>

using namespace testing;

int g(int x)
{
    return x;
}

int f(int x, int y)
{
    return x + y;
}

int main()
{
    std::vector<int> v = {1,
        2};

    g(f(1,
        2));

    EXPECT_THAT(v, ElementsAre(1,
        2));
}
$ clang-format x.cpp
#include <vector>
#include <gmock/gmock.h>

using namespace testing;

int g(int x)
{
    return x;
}

int f(int x, int y)
{
    return x + y;
}

int main()
{
    std::vector<int> v = {1,
        2};

    g(f(1,
        2));

    EXPECT_THAT(v, ElementsAre(1,
        2));
}

clang-format 4 did just fine here and kept the format that I expect.

Best regards
Dennis</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>