Debian Codegraph @

clang-tools-extra/docs/clang-tidy/checks/misc/include-cleaner.rst

raw
1 .. title:: clang-tidy - misc-include-cleaner
2
3 misc-include-cleaner
4 ====================
5
6 Checks for unused and missing includes. Generates findings only for
7 the main file of a translation unit.
8 Findings correspond to https://clangd.llvm.org/design/include-cleaner.
9
10 Example:
11
12 .. code-block:: c++
13
14 // foo.h
15 class Foo{};
16 // bar.h
17 #include "baz.h"
18 class Bar{};
19 // baz.h
20 class Baz{};
21 // main.cc
22 #include "bar.h" // OK: uses class Bar from bar.h
23 #include "foo.h" // warning: unused include "foo.h"
24 Bar bar;
25 Baz baz; // warning: missing include "baz.h"
26
27 Options
28 -------
29
30 .. option:: IgnoreHeaders
31
32 A semicolon-separated list of regexes to disable insertion/removal of header
33 files that match this regex as a suffix. E.g., `foo/.*` disables
34 insertion/removal for all headers under the directory `foo`. By default, no
35 headers will be ignored.
36
37 .. option:: DeduplicateFindings
38
39 A boolean that controls whether the check should deduplicate findings for the
40 same symbol. Defaults to `true`.