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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format]: obey BlockIndent for templates
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    # to reproduce

`.clang-format`
```yaml
AlignAfterOpenBracket: BlockIndent
AllowAllArgumentsOnNextLine: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'false'
BinPackArguments: 'false'
BinPackParameters: 'false'
ColumnLimit: '120'
ContinuationIndentWidth: '1'
IndentWidth: '1'
Language: Cpp
Standard: Cpp11
TabWidth: '1'
UseCRLF: 'false'
UseTab: ForContinuationAndIndentation
```

`main.cpp`:
```cpp
void function(int asdfasdfsdhgfjhksdgfjkhsd, int sdlfsdkljahgdfklsjhgdf, int sadlkghjasdlkghjfd, int sadlkghjasdlkghjfd, int sadlkghjasdlkghjfd, int sadlkghjasdlkghjfd);

typedef typename std::conditional<
func_one_arg,typename type_or_void<std::invoke_result<F, func_arg_type>>::type,
typename type_or_void<std::invoke_result<F, func_arg_type, size_t>>::type
>::type func_return_type;
```

# expected result

```cpp
void function(
        int asdfasdfsdhgfjhksdgfjkhsd,
        int sdlfsdkljahgdfklsjhgdf,
        int sadlkghjasdlkghjfd,
        int sadlkghjasdlkghjfd,
        int sadlkghjasdlkghjfd,
        int sadlkghjasdlkghjfd
);

typedef typename std::conditional<
        func_one_arg,
        typename type_or_void<std::invoke_result<F, func_arg_type>>::type,
        typename type_or_void<std::invoke_result<F, func_arg_type, size_t>>::type
>::type func_return_type;
```

# actual result

```cpp
void function(
        int asdfasdfsdhgfjhksdgfjkhsd,
        int sdlfsdkljahgdfklsjhgdf,
        int sadlkghjasdlkghjfd,
        int sadlkghjasdlkghjfd,
        int sadlkghjasdlkghjfd,
        int sadlkghjasdlkghjfd
);

typedef typename std::conditional<
        func_one_arg,
        typename type_or_void<std::invoke_result<F, func_arg_type>>::type,
        typename type_or_void<std::invoke_result<F, func_arg_type, size_t>>::type>::type func_return_type;
```
As one can see, closing `)` for function is moved to a new line, but closing `>` for template is not moved to the new line.

# version

```console
$ clang-format-14 --version
Debian clang-format version 14.0.1-++20220426012052+0e27d08cdeb3-1~exp1~20220426132142.127
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVtuOozgQ_RryYgVxDckDD0l6WlqptT3ai_YxMrgAJ8aObJOZ3q_fMgRy2d7u1dyeRnIwrjpVPmVOoArFXnIviolVRMNRK9aV4AUPXrA-XxeBXwoq63mldEstrifHMF5oKwbTWvBarisL-vkIcqNpeQDrxWuyEao8_CIZSDsihfqEl7Wuuxat5ln-Cp_tE5fg8F6UVVQYwPkW_5Fq2gJuYJ6rB0Bemlqu5DvRGy4_Ipdps7dAlx1eRW2V6Fr5xFtuz_4wCq680nLZ9ZyGcv_izDYjcsK95XvCs-5o3VeyPR4H4--WSkY1OxvDcDD_QYvXk_xpYPvb0-OrJaAP45zrUelrxmvJBmL96u4p32mipVz6JdJDT7y-w5Yj7ZPijFSdLPuE0ZJLS6hhlfsZ1tTVvjkYhtOhMcyLtsQBDBPoPIg9bWpWHYTZu3nyUiYOdbPHFP1csW_tWXnx5rpa-3IEBhVxs0RtEGPdc8BRKsm4K40KL94OaFftTknYUV3jLlOQu9kpvXNHguApB5cndYCdBtMJlNT20VHrk2CCnYvy4g_9cOh-HW0vxL42NxoM_xt29l-7DCdwbRpCNdhOyzOzzVsqwbcKfD5CaYGRM4dbEb2jlhG9ek82N8D_lM8t6jVJ_AjE-Wi-TmSY_k5nk_17Cu4bpf_OmqOl7aj4qbifivsfivsira0NwXMgJZXEQJ-9FMpwWRMHwZNeBAS7pUlZhBvSqhO-BrHLokTCJyJcr4KBRWdvgpHPOdhCexTUgguWyl4S2A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