[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang-tools-extra / docs / clang-tidy / checks / readability / duplicate-include.rst
blob45df7e1b84f3f2e3a87001ff0fc5bab998eed921
1 .. title:: clang-tidy - readability-duplicate-include
3 readability-duplicate-include
4 =============================
6 Looks for duplicate includes and removes them.  The check maintains a list of
7 included files and looks for duplicates.  If a macro is defined or undefined
8 then the list of included files is cleared.
10 Examples:
12 .. code-block:: c++
14   #include <memory>
15   #include <vector>
16   #include <memory>
18 becomes
20 .. code-block:: c++
22   #include <memory>
23   #include <vector>
25 Because of the intervening macro definitions, this code remains unchanged:
27 .. code-block:: c++
29   #undef NDEBUG
30   #include "assertion.h"
31   // ...code with assertions enabled
33   #define NDEBUG
34   #include "assertion.h"
35   // ...code with assertions disabled