<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/137292>137292</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clangd] end of line /// comment on member incorrectly attached to following member
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RedBeard0531
</td>
</tr>
</table>
<pre>
For end-of-line comments like `int foo; /// foo clangd` will attach the comment to the next member rather than the one it shares a line with. This seems to clearly be missing the intent of the developer even if the doxygen spec says they should be using `///< foo`. Any end-of-line comment always is assumed (by humans) to attach to the code is shares a line with, even if comments attach to the next thing when the whole line is a comment.
```cpp
struct S {
int foo; /// ***foo***
int bar;
};
int x = S().bar;
```
Hovering over the last `bar` shows the doc comment `***foo***`.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VEGP8yYQ_TX4MnKEsY3jgw_JF0Xttds_gM0k0GKIACebf1-BnexWXVVCMjDMy3tvZiJC0FeLOJD2SNpTIZaonB_-QHlE4SVt66oYnXwOZ-cBrSzdpTTaIkxuntHGAEb_jUA41TbCxTlSH4Gw87rSBUxG2KsknMJDGwMiRjEpiOqNAdHlo8XPCDPOI3rwIir0EJWwOeYsgo4QlPAYQEDm8NBR7eBPpQMExDkkoMmg8OYJI8KsQ9D2mvO1jemX3CWfJN7RuBt6wDta0Nut-3xe0UK44QRBPEO6fUJQbjEyAS4ZjnD6FkjqX1k0pzs42OdPDoEwj4SlA4gQlhklELYfn6CWWdhAWJ9ov1xxmzESU8J_5RL26835XYJ_J2cbo0pUHwpX-x7KGVxREo9X6o7QQ1qcrmu63Qg9hOiXKcIHkO5I6AEA4MfiEnZYV4q89t8SRuFJnRBId9o29JACn0DqE3wQties363P4DuP9elv7o4-yUjfLMOIEJP_KYXTVJlH2Eo3vf3O9fmJGacvvawi7fH3WVyRtCfC9irGWyD1YRV21VEt425yM2HnJaAvV4Oz2YSdRQiYN6xHWU9NXVajYGXToyz3tazKkXPe8bESfSUI6ws51LKve1HgUHVN23LOm6pQg7yIhmM31YI29UVy2fWsr7rLiOPUVqwp9MAoa2nDWtrVHat2bSV4J7vu0u5l1-1r0lCchTY7Y-7zzvlroUNYcKjqjvWsMGJEE_JsM2bxATlKGEuj7oeUVI7LNZCGGh1i-IKJOpr8p7BNb3tKvZ3mJzfRVxO8XHf2NbraTs57nKJ5bp2JMvXmxRnjHqme68Ni8Wb4H-cTl-1T3rz7C6dI2DkrSOZvEu8D-ycAAP__7nOCkw">