[clang] [clang-tools-extra] [clang-tidy] [Modules] Skip checking decls in clang-tidy (PR #145630)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 25 00:06:08 PDT 2025


ChuanqiXu9 wrote:

> If modules are considered as system headers in clang-tidy, there was work in #128150 to reduce scope of traversal to match only in user code (I suppose it would affect modules too). But that PR had to be reverted due to appeared issues with downstream users. Hopefully it will reland in the future. @carlosgalvezp may shine some light on this matter.

I think modules are not system headers. For the example in the issue, the module interface is not system nor headers. It is  another TU but we just can get AST from it. I think it may be a valid expectation to not check the same TU again and again for different consumers.

> 
> Treating modules separately doesn't seem right to me. Also, If we exclude only `decls` what happens with `stmts` and other nodes, are they still getting matched and filtered? What happens if a check looks for a `decl` inside system header and later compare it to `decl` inside user-code?

For "stmts" and other "nodes", my expectation is to exclude them as well. I just want to avoid duplications.

https://github.com/llvm/llvm-project/pull/145630


More information about the cfe-commits mailing list