[PATCH] D159263: [clang-tidy] misc-include-cleaner: remove duplicated includes & fixes
Ding Fei via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 31 08:27:35 PDT 2023
danix800 added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/misc/IncludeCleanerCheck.cpp:169
+ else
+ Unused.push_back(&I);
+ continue;
----------------
sammccall wrote:
> If we want this policy, it should be provided at the include-cleaner library level so it applies to all clients, not just the clang-tidy check.
>
> I think the clearest way is to encapsulate this in include_cleaner::Includes, so that match() never matches a Header requirement against a duplicative Include. This will naturally lead to the directives being marked as unused.
>
> (In practice, the result will work in clangd, and will respect configuration of headers where analysis should be ignored, keep directives, etc)
I'll leave the policy part to another revision (maybe by others).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159263/new/
https://reviews.llvm.org/D159263
More information about the cfe-commits
mailing list