[clang-tools-extra] [clang-tidy] Add ClangQueryChecks config option (PR #123734)

via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 9 23:01:22 PDT 2025


DeNiCoN wrote:

> Hello @DeNiCoN, Are you still working on this patch? If not, I hope I can take over this patch to finally finish it.

Hello @HerrCai0907. I'm not actively working on it. You can take over

Some notes:
I've found a bug that if a config file is not explicitly specified(no `--config-file` option given) custom checks do not run. This happens because in the current code custom checks are added at the start but `ClangTidyContext::CurrentOptions` gets updated by finding nearest config file only later. I've used the following workaround https://github.com/llvm/llvm-project/commit/e30df2d7d686efc832a6f3107235a8e4decbac65
But I believe in the current state it introduces a bug that some checks can be used even if they are not defined in the parent configuration files because it updates `CheckFactories` globally

I've also found that --list-checks would only list custom checks for the first file specified https://github.com/llvm/llvm-project/blob/c4808741e89df29dcd06c7be2784824c82f34e46/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp#L623
And --verify-config does not respect custom checks
clangd seems to not see custom checks because it uses `ClangTidyModuleRegistry` to get all checks

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


More information about the cfe-commits mailing list