I have a big project with hundreds of files. And as it often happens to C++ projects, #include
directives are messed up. I want to refactor them to increase clarity, decrease compilation time and simplify analysis.
For each .h file, I want to make sure that:
- It have
#include
directives only for types it is using - But it have only forward declarations of types that are used as
T*
orT&
For each .cpp file I want to make sure that:
- It have
#include
directives only for types it is using and not already included by another headers (no indirect includes when possible)
I'm looking for a tool which will help me to automate this refactoring. For now, I only know of tools that help to remove redundant includes. Some of them are:
- PC-lint
- include-what-you-use
- cppclean
- ProFactor IncludeManager
But I know of no tools to help me to move necessary includes in .h files or replace includes with forward declarations. Any ideas? Tools for Windows and Visual Studio are preferred.