18 Commits

Author SHA1 Message Date
Kazu Hirata
ba007a60d0
[clang-tidy] Remove unused includes (NFC) (#141420)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-05-25 10:55:36 -07:00
Daan De Meyer
c46a394df9
[clang-tidy] Add UnusedIncludes/MissingIncludes options to misc-include-cleaner (#140600)
These mimick the same options from clangd and allow using the check to
only check for unused includes or missing includes.
2025-05-21 16:41:04 +02:00
Congcong Cai
222dd235ff
[clang-tidy] use local config (#120004)
follow up patch for #119948.
2024-12-18 18:38:46 +08:00
Kazu Hirata
76bbbcb41b [clang-tidy] Use StringRef::{starts,ends}_with (NFC)
This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.
2023-12-13 23:11:05 -08:00
Jan Svoboda
cb92511c4d
[clang] NFC: Remove OptionalDirectoryEntryRefDegradesToDirectoryEntryPtr (#74900) 2023-12-08 18:22:53 -08:00
kadir çetinkaya
77feba5a92
[clang-tidy][IncludeCleaner] Fix analysis supression in presence of verbatim spellings (#68185) 2023-10-05 18:22:02 +02:00
Jan Svoboda
98e6deb62c [clang][tools] Use FileEntryRef in include_cleaner::Header 2023-09-09 09:54:13 -07:00
Viktoriia Bakalova
43c20367f4 [include-cleaner][clangd][clang-tidy] Ignore resource dir during include-cleaner analysis.
Differential Revision: https://reviews.llvm.org/D157610
2023-09-07 11:39:18 +00:00
Congcong Cai
b0831c3996
[clang-tidy][misc-include-cleaner]Avoid to insert same include header multiple times (#65431)
`HeaderIncludes` won't update `ExistingIncludes` during inserting.
We need to manage it in tidy check.

Fixed: #65285
2023-09-06 17:37:14 +08:00
Kadir Cetinkaya
90ecadde62
[include-cleaner] Filter references to identity macros
Despite being true positives, these results just confuse users. So
filter them out.

Differential Revision: https://reviews.llvm.org/D157905
2023-08-18 14:40:03 +02:00
Kadir Cetinkaya
89d0a76be6
[clang-tidy][include-cleaner] Add option to control deduplication of findings per symbol
We received some user feedback around this being disruptful rather than
useful in certain workflows so add an option to control the output behaviour.

Differential Revision: https://reviews.llvm.org/D157390
2023-08-08 16:01:33 +02:00
Kadir Cetinkaya
43974333dd
[include-cleaner] Unify always_keep with rest of the keep logic
Depends on D156122

Differential Revision: https://reviews.llvm.org/D156123
2023-08-02 12:47:53 +02:00
Kadir Cetinkaya
778a5e9bc6
[include-cleaner] Introduce support for always_keep pragma
Differential Revision: https://reviews.llvm.org/D156122
2023-08-02 12:47:53 +02:00
Sam McCall
f6307b260b [include-cleaner] Switch Include from FileEntry* -> FileEntryRef
Unlike Header, we really do have a preferred spelling for an include: the one
that we used to open the file.

The fact that Header is still FileEntry* makes it difficult to accidentally
use path equality when we want inode equality.

Differential Revision: https://reviews.llvm.org/D155885
2023-07-26 13:41:55 +02:00
Haojian Wu
2444fb9643 [clang-tidy] Don't emit the whole spelling include header in include-cleaner diagnostic message
To keep the message short and consistent with clangd, and the diagnostics are
attached to the #include line, users have enough context to understand the whole #include.

Differential Revision: https://reviews.llvm.org/D154434
2023-07-04 14:32:27 +02:00
Haojian Wu
eed4a4d02e [clang-tidy] Correct the include-cleaner-check diagnostic message for missing-includes.
We should print the symbol name rather than the header name in the
message.

Differential Revision: https://reviews.llvm.org/D153013
2023-06-15 15:26:48 +02:00
Viktoriia Bakalova
90c5fe9822 [include-cleaner] Allow multiple strategies for spelling includes.
Summary:

Reviewers:

Subscribers:

Differential Revision: https://reviews.llvm.org/D150185
2023-06-05 09:47:12 +00:00
Viktoriia Bakalova
c28506ba4b [clang-tidy] Implement an include-cleaner check.
Differential Revision: https://reviews.llvm.org/D148793
2023-06-02 15:21:20 +00:00