<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58529>58529</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-format not formatting template functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          bbennetts
      </td>
    </tr>
</table>

<pre>
    In the attached code + config the template function is not getting formatted - note the west const is not switched to east and the newlines are not removed unlike in the non-template function.  

clang-format version 14.0.6 (Red Hat 14.0.6-1.module_el8.7.0+1198+0c3eb6e2)

[templateFormatting.tar.gz](https://github.com/llvm/llvm-project/files/9840292/templateFormatting.tar.gz)

Before 

`#pragma once

template< FOO >
auto foobar( const FOO* f ) -> void
{
    return;
}

auto barbaz( const int* i ) -> void
{
    return;
}`

Format output

`#pragma once

template< FOO >
auto foobar( const FOO* f ) -> void
{
    return;
}

auto barbaz( int const* i ) -> void { return; }`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVE2PmzAQ_TXmMgqyzUfgwCFpGrWnlfoHKgMDcWvsyDaJur--E9h0s9r20N6KEP6Y8Zv3xjO0rv_RfLYQTwgqRtWdsIfO9QhM7mliBz0uxojT2aiIMMy2i9pZ0AGsizBijNqOMDg_EQId39z2cTl1xRBvKPR9cQ9XHZcg0QEq2le2X1wtXo22GEB5XDw9Tu5CjrM1-juCXklaZzfvuKQAjB8Y363fzig7blZCcEEfbnRFnvK0JFnVFwL9RJZ1ZyPSyfWzwa9oqnSbchIuRF3RwLsM2xIlk_UjPCv2dwbHVTTpT6Py6fjMigNFOMV4DizbMXmkd9TxNLdp5yZaGHO5D5uzd9-wi7QctMFAY13lXNYU8PjnCG_J7JF04hv5rCQN2dmrcVLgbIePxjsuyz7A8ekJWPZxNaiZbmRwrlWeFLxcGnkwuYOB0lbDhnzh4nT_grfdrxOgx2OcvWXZ_m47PAZdsAm4Vc-v2NrGG7b-F2xS-AC_5gjcHM9z_K8yQTlY8X-TCSDYVzRYZSfYiLIss7KQnCd9k_V1Vqsk6miweVP3txYafhXP-_4NyexN89eVqkOYl1ItqkLWyanJ82FoVbHNqFGkVH1RFGWVDXWdCyGzPk-MatGEhrqGSUldDgsEzalXEt1ILqXgUohCZJKnVS8E72Urhm2ruBhYznFS2qQ3HqnzY-KbhVI7j4GMRocYXo0qBD1axCUc4VO-T843bYvW0o8qJEvwZiH_E6JGhG8">