<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57504>57504</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Namespace name comments after closing brace misaligned/indented with more than 2 nested namespaces and AlignTrailingComments=true
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TriazoneZero
</td>
</tr>
</table>
<pre>
Hello,
I am using clang-format 14 and in my .clang-format file, if have set the following parameters that affect the namespaces:
```
AlignTrailingComments: true
CompactNamespaces: false
FixNamespaceComments: true
NamespaceIndentation: All
ShortNamespaceLines: 0
BraceWrapping:
AfterNamespace: true
SplitEmptyNamespace: true
```
If I have a more than two namespaces, I encounter the following formatting:
```
namespace A
{
namespace B
{
namespace C
{
namespace D
{
namespace E
{
} // namespace E
} // namespace D
} // namespace C
} // namespace B
} // namespace A
```
Which shows that the AlignTrailingComments parameter provokes this formatting, which is wrong to me. Whether all namespace comments should be indented or none. I would prefer **none**. If I set
```
AlignTrailingComments: false
```
and leave the rest as is, I get the behavior I would expect here:
```
namespace A
{
namespace B
{
namespace C
{
namespace D
{
namespace E
{
} // namespace E
} // namespace D
} // namespace C
} // namespace B
} // namespace A
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztVd9vmzAQ_mvg5dSIEJKOBx7S0GqRpr20UqW9GTiCN2Mj25R2f_3OkB-QJlu350WIGN_dd5_t-86ZKt6SzyiE8sKNF6ResB7eW2A1tIbLHeSCyd1NqXTNLMwjYLIALqF-g9nEVHKBhAK8hIq9IBi0YCuEUhF855AaplmNFrUhA0WwssR8cJJkMA3L0XiLPQVvFeyf_nMt-E4-acYFQW1UXaO0zhmsbnFwoVmCsF_HWFAyYfb2B_56tF1GOJq3siArs1xJ57EWYnB4rJQ-JfjC5ZBkz_FO0-SzZk1DHI8LAViXtOhj1DQlwGMjuL2vG_t2xeVsJ_YnVMJ22GgGtdLotlSC7dR4L-k4toAyV60kBmfHMZybHVM9y3REgoP99u7AGk55YDQ58Zh6baaGd55T7_S98WLENOr-ssMx8po5pVf4QM_vsXrHfnDunJ4vLh1FnTtvxvuVwuT3zvnA_CLHy-c2vJ8rnldgKtXt9eaO_6KMTsqERqsX9QNdBDfjEqFS6npAmu60ovqxCmqcwXOFBKyBCTEilh-gKX8rCsiQmobTFBagNEglKXQLXW9sNJaE4IVrepxpGJGDK3JqJH_XEUaSPwtxvUugE43bC42GmpChFQ1C2e07VoakK04sD_zwtXGNilaJJ6n8F8xHBfMhsfxRJP8mjOvyAB-T-WoVBtHqUxj6RbIo4kXMfMutwOTYinvMUzkz18rpTlT93Zi5hg81N8zVIhbE4VjlHbfVqDOHQHeFmz-15_4qvVLFqWv_fqtFUlnb9Ldiv8QdobbZjPjQhxAvh78bEu53KlLHwJjW9f6H5e0yiPwqWZX5PMrjxSIPP83j25IVWZAHqziMo-w2Wyx9wTIUJvGWd14YSuygh6Cxt0x9noRBGAZxMJ8vIxrNwohRNBZBHOMSw8KLAqyJ_8zxmCm983XSU8ranSGj4Maak5EZ4_YK-3SEz1pLl2rypDn7SdL_hlr5ff6k5_8LxAp_zg">