52 lines · plain
1.. title:: clang-tidy - misc-include-cleaner2 3misc-include-cleaner4====================5 6Checks for unused and missing includes. Generates findings only for7the main file of a translation unit.8Findings correspond to https://clangd.llvm.org/design/include-cleaner.9 10Example:11 12.. code-block:: c++13 14 // foo.h15 class Foo{};16 // bar.h17 #include "baz.h"18 class Bar{};19 // baz.h20 class Baz{};21 // main.cc22 #include "bar.h" // OK: uses class Bar from bar.h23 #include "foo.h" // warning: unused include "foo.h"24 Bar bar;25 Baz baz; // warning: missing include "baz.h"26 27Options28-------29 30.. option:: IgnoreHeaders31 32 A semicolon-separated list of regexes to disable insertion/removal of header33 files that match this regex as a suffix. E.g., `foo/.*` disables34 insertion/removal for all headers under the directory `foo`. Default is an35 empty string, no headers will be ignored.36 37.. option:: DeduplicateFindings38 39 A boolean that controls whether the check should deduplicate findings for the40 same symbol. Defaults to `true`.41 42.. option:: UnusedIncludes43 44 A boolean that controls whether the check should report unused includes45 (includes that are not used directly). Defaults to `true`.46 47.. option:: MissingIncludes48 49 A boolean that controls whether the check should report missing includes50 (header files from which symbols are used but which are not directly included).51 Defaults to `true`.52