tidy - readability-duplicate-include — Extra Clang Tools 22.0.0git documentation (original) (raw)

Looks for duplicate includes and removes them. The check maintains a list of included files and looks for duplicates. If a macro is defined or undefined then the list of included files is cleared.

Examples:

#include #include #include

becomes

#include #include

Because of the intervening macro definitions, this code remains unchanged:

#undef NDEBUG #include "assertion.h" // ...code with assertions enabled

#define NDEBUG #include "assertion.h" // ...code with assertions disabled

Options

IgnoredFilesList

A semicolon-separated list of regular expressions or filenames that are allowed to be included multiple times without diagnostics. Matching is performed against the textual include name. Default is an empty string.