On Sat, Aug 3, 2013 at 5:47 PM, Mike Hommey <m...@glandium.org> wrote: > > One piece of the puzzle, at least in Mozilla code, is the tendency to > #include "Foo.h" when class Bar contains a field of type Foo*, instead of > leaving the include to Bar.cpp and forward declare in Bar.h. This > certainly contributes to the conflation of the number of includes (most > if not all includers of Bar.h don't need Foo.h, and that chains up > pretty easily). > > I don't remember if IWYU tells about those. Does it?
It does! In the "file X should add the following:" parts it lists both #includes and forward declarations. Despite its imperfections[*] it's a pretty good tool, and you can get much further, much faster with it than you can manually. If anyone wants to try it out, I'm happy to help with setting it up and all that. Nick [*] One imperfection I forgot to mention is that, although it gives me info on every .cpp file in SpiderMonkey, for some reason it doesn't give me info on every .h file, and I haven't worked out why. This is frustrating, since minimizing #include statements in .h files is likely to have bigger benefits than minimizing them in .cpp files. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform