<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55162>55162</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format: FixNamespaceComments - missing comments sometimes with nested namespaces
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
H-G-Hristov
</td>
</tr>
</table>
<pre>
I use C+17's nested namespaces. Sometimes for a snippet like the one bellow no comments are added after the closing namespaces.
```
#pragma once
#include <....>
#include "...."
namespace mycomp::util {
class IFData;
} <----- expected but missing // namespace mycomp::util
namespace mycomp::data {
class IData;
} <----- expected but missing // namespace mycomp::data
namespace mycomp::data {
class Data :: public IData {
public:
void DoSomething();
}
} // namespace mycomp::data <------ this is added
```
Input:
```
#pragma once
#include <....>
#include "...."
namespace mycomp::util {
class IFData;
}
namespace mycomp::data {
class IData;
}
namespace mycomp::data {
class Data :: public IData {
public:
void DoSomething();
}
}
```
Expected:
```
#pragma once
#include <....>
#include "...."
namespace mycomp::util {
class IFData;
} // namespace mycomp::util
namespace mycomp::data {
class IData;
} // namespace mycomp::data
namespace mycomp::data {
class Data :: public IData {
public:
void DoSomething();
}
} // namespace mycomp::data
```
Reality:
```
#pragma once
#include <....>
#include "...."
namespace mycomp::util {
class IFData;
}
namespace mycomp::data {
class IData;
}
namespace mycomp::data {
class Data :: public IData {
public:
void DoSomething();
}
} // namespace mycomp::data
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlVs1unDAQfhpzGYHAwLJ74JBdsk0uPbRPYGAAtwYjbPLz9h2c7CZptdlWVZVGsUbA4E_jb35sT6nr-_waZoOwY3wbZYxnBgY0FmsYRI9mFBWaAL7qHq0kHRo9gQAzyHFEC0p-R7Adgh4QSlRK38KgodJ9j4M1ICYEUddkTTQWJwetlDZyaJ_bZ2HBwosXz1X4KA8qj8dJtL2ghSp8AeSxHCo11wgs3gU0WHx5CsC5A3D-HHDkAf09ER9ZfEEyW6mAZdvnyEoJY-B6XwgrWPxiimUF_OEguv4yAO9GrJaIl7OFXhoXHcb3JHCa3HkXaqJ5woU392Dh9jceFG7GgWCcSyWrB6ee0A9_F4hTF743WtZQaFfMHVFkfM345ikOWfFzQM768HpgfCp4aYDEbYLXCtw9r4dxtkfK73Yn_IPS_P9r5WxyLx83yfvP79scTh_iPDlbRV9QKGnv338RfchD4rcL4JBPr87jehNvhGelVZgT2aH1qQnrxXJRwF7efT7Y2h26Lv94Bx8bMXNs4G6l7X5t8bx5Unln7WgWKo5kS8C5DMgEKUrdHF7-OOlvdJKRSqvMaOgjTaMV97qcJytMmiZustUqS5ooEptMbKJqVQpsOFaeEtQlmpylW5YWnsx5yHmY8HUUxkm0DrIkbXi1XmMjmrRMQ5aE2AupgmXhQE-tN-WOQzm3hiaVNNY8TVIiZTsgHuyL2XZ6yq_8T_7VRFB94znKueP7A-5yCe4">