[clang] [Clang][Comments] Attach comments to decl even if preproc directives are in between (PR #88367)
Dmitri Gribenko via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 2 00:54:51 PDT 2024
gribozavr wrote:
I'd like to push back against this change, I believe it is too broad. (Full disclosure: I'm the original author of this subsystem in Clang.)
We (Google) are integrating this change downstream and it causes a bunch of comments to get associated to unrelated declarations. The problem is particularly bad with file-level comments, which get attached to the first declaration.
For example: https://github.com/google/crubit/blob/main/rs_bindings_from_cc/test/golden/definition_of_forward_declaration.h
In this file the license comment gets attached to `ForwardDeclaredStruct` even though they are separated by an `#include` directive.
I think you should at the very minimum check for `#include` directives as a negative signal that breaks the connection.
https://github.com/llvm/llvm-project/pull/88367
More information about the cfe-commits
mailing list