make header include refactoring possible
This suggestion is migrated to Developer Community. Please use below link to view the current status.
Would be great to have a tool which will automatically remove unused headers. I a big projects (more than 1^6 LOC ) this becomes really both code and compile-time issue over the time.
Another idea is to move from precompiled header those header files which are used only once and move those used more than once into precompiled header. Ideally those thresholds are configurable.
I wrote a plugin for various include refactoring tasks, but the "include-what-you-use" integration is quite poor so far.
Edward Lambert commented
This would be very welcome, builds times are a massive issue
Philip Sansone commented
I work on a large project with a long history and some files have enough unnecessary includes to add a 15% penalty to the compilation time. Letting Visual Studio run overnight (if necessary) to get rid of all the unnecessary includes would be a big win.
Also, the feature may want to ignore precompile directives that turn off code (except #if 0) so codebases that have a lot of switches don't have to run the tool separately for each configuration.
Google has a tool called include-what-you-use. It would be nice to have such a tool integrated into Visual C++.
Aaron Daily commented
This tool should also help manage "using" statements.
And it should suggest forward declarations which would remove further includes.