| 1 |
.. title:: clang-tidy - readability-duplicate-include |
| 2 |
|
| 3 |
readability-duplicate-include |
| 4 |
============================= |
| 5 |
|
| 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. |
| 9 |
|
| 10 |
Examples: |
| 11 |
|
| 12 |
.. code-block:: c++ |
| 13 |
|
| 14 |
#include <memory> |
| 15 |
#include <vector> |
| 16 |
#include <memory> |
| 17 |
|
| 18 |
becomes |
| 19 |
|
| 20 |
.. code-block:: c++ |
| 21 |
|
| 22 |
#include <memory> |
| 23 |
#include <vector> |
| 24 |
|
| 25 |
Because of the intervening macro definitions, this code remains unchanged: |
| 26 |
|
| 27 |
.. code-block:: c++ |
| 28 |
|
| 29 |
#undef NDEBUG |
| 30 |
#include "assertion.h" |
| 31 |
// ...code with assertions enabled |
| 32 |
|
| 33 |
#define NDEBUG |
| 34 |
#include "assertion.h" |
| 35 |
// ...code with assertions disabled |