Issue 137292
Summary [clangd] end of line /// comment on member incorrectly attached to following member
Labels new issue
Assignees
Reporter RedBeard0531
    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***`.

![Image](https://github.com/user-attachments/assets/29ed3c43-1ba2-49ed-83d1-b66676b1a91a)
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to