summaryrefslogtreecommitdiff
path: root/bin/find-unneeded-includes
AgeCommit message (Collapse)Author
2019-07-29find-unneeded-includes: warn first time user nicely about missing fileGabor Kelemen
Change-Id: Ibc0b818a410cf0aee19b1d2a42a53db9aff87638 Reviewed-on: https://gerrit.libreoffice.org/76461 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-07-15find-unneeded-includes: raise maximum output line lengthGabor Kelemen
This is helpful when checking and rechecking the detailed output. It happens often that removing an unnecessary header makes it necessary to add a transitively included header. This is indicated by an error message referring to a now unknown class name. Finding that header was hard because the default 80 char output limit usually truncates the class names. Change-Id: Iae08bc326625961009038007db4a982859f64c8c Reviewed-on: https://gerrit.libreoffice.org/75598 Reviewed-by: Michael Stahl <Michael.Stahl@cib.de> Tested-by: Michael Stahl <Michael.Stahl@cib.de>
2019-07-15find-unneeded-includes: don't propose to replace hpp with hdl...Gabor Kelemen
in the ooo/vba namespace either. Quite frequent in sc/source/ui/vba Change-Id: I62c89bb430455f025b25f1246e55012b411db21e Reviewed-on: https://gerrit.libreoffice.org/75597 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2019-06-17find-unneeded-includes: show command line in case of IWYU error messagesGabor Kelemen
In case of non self contained files IYYU gives only error messages. Prepare for that and print the failing command for further investigation. Change-Id: I744338ab14d4a6cba5e02f842ff74b156c5178a4 Reviewed-on: https://gerrit.libreoffice.org/74111 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-06-12find-unneeded-includes: don't propose to replace boost/functional/hash.hppGabor Kelemen
As seen in vcl/inc/widgetdraw/WidgetDefinition.hxx Change-Id: Ic56ebd0f1c62b7cad25694b95bf8f91435169db9 Reviewed-on: https://gerrit.libreoffice.org/73753 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-06-03find-unneeded-includes: don't propose to remove <map>...Gabor Kelemen
..and replace with debug header if multimap is used. As seen in include/svx/SmartTagMgr.hxx Change-Id: If239cd6e9471f74f3035c659077ed7515a9df473 Reviewed-on: https://gerrit.libreoffice.org/73367 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2019-05-31find-unneded-includes: don't suggest removal of fwd declsMiklos Vajna
Removal of those have to be decided manually: 1) If it would be removed to be replaced with an include, that's bad. 2) If the fwd decls is truly unused, that's good. Focus on the mechanical part: removal of includes which are unused, and where removal doesn't introduce a transitive dependency. Verified that e.g. writerfilter/source/dmapper/DomainMapper.cxx reports no removals now, but including e.g. filter/msfilter/rtfutil.hxx in either writerfilter/source/dmapper/DomainMapper.cxx or writerfilter/source/dmapper/DomainMapper.hxx triggers a removal hint. Change-Id: I4c359318113ccba421a125984e23c9778567ea4e Reviewed-on: https://gerrit.libreoffice.org/73240 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2019-05-31find-unneded-includes: avoid replacing includes with forward-declarationsMiklos Vajna
Verified that e.g. writerfilter/source/dmapper/DomainMapper.cxx used to trigger advices to replace includes with forward-declarations, and now that's gone. See https://gerrit.libreoffice.org/#/c/72972/ for motivation, there are cases where a forward-declaration depends on the version of the external, while the include does not, so such changes have to be done with more care. Change-Id: I86d396ac743b3fc425868ffda26c0c9e85a00d0e Reviewed-on: https://gerrit.libreoffice.org/73221 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-05-09find-unneeded-includes: dont propose to replace cstdint with internal headerGabor Kelemen
As seen in tools/source/misc/cpuid.cxx Change-Id: Ic596cca387efc1c310f65cbed141946be0742371 Reviewed-on: https://gerrit.libreoffice.org/71885 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2019-05-09find-unneeded-includes: filter out boost/unordered_map.hppGabor Kelemen
As seen in configmgr/source/modifications.hxx and configmgr/source/partial.hxx this replacement is not needed Change-Id: I6a8d7bc37779f305fccb5d3c7df22fba4a4f73d0 Reviewed-on: https://gerrit.libreoffice.org/72013 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2019-05-08find-unneeded-includes: dont propose to replace ctime with internal headerGabor Kelemen
As seen in sw/source/core/inc/layact.hxx Change-Id: Icc4281cd57b0cd8310a1044f6106691a5d1cd3c4 Reviewed-on: https://gerrit.libreoffice.org/71884 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-05-06find-unneeded-includes: don't try to replace forward_list with debug headerGabor Kelemen
As seen in tools/source/inet/inetmime.cxx Change-Id: I3122e07a01020e84b5b75bc46dcaca33560b84bb Reviewed-on: https://gerrit.libreoffice.org/71558 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-04-09find-unneeded-includes: fix tuple default items in debugStlGabor Kelemen
So it gives no false positives as currently seen in e.g. include/sfx2/charmapcontrol.hxx include/sfx2/docinsert.hxx Change-Id: I087a949875df20c4ef25a10c80571bb57334cf80 Reviewed-on: https://gerrit.libreoffice.org/70400 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-04-03find-unneeded-includes: filter out boost/variant.hppGabor Kelemen
As seen in include/sfx2/sidebar/Paint.hxx this replacement is not needed Change-Id: Idba8014a7effaec69c06891657cbd62546b7ac09 Reviewed-on: https://gerrit.libreoffice.org/70026 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-04-02find-unneeded-includes: use a better data structureGabor Kelemen
Turns out plain dictionary requires keys to be unique. So we need to store values as lists. This way there are no more false positives for <set> as in include/sfx2/linkmgr.hxx and include/sfx2/objsh.hxx Thanks Miklos for the advice! Change-Id: Ie2cfb63644d6cbd51171eb95e3bcdd9246343efa Reviewed-on: https://gerrit.libreoffice.org/69953 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-22find-unneeded-includes: don't try to fw. declare o3tl/span.hxxGabor Kelemen
As seen in include/sfx2/dispatch.hxx IWYU proposes to replace o3tl/span.hxx with fw declaration, but that won't compile Change-Id: If5739075bd91511cf22a39f3382c424c21829053 Reviewed-on: https://gerrit.libreoffice.org/69397 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-18find-unneeded-includes: don't propose debug/set.h if multiset is usedGabor Kelemen
As seen while cleaning sd/source/ui/dlg/TemplateScanner.cxx Change-Id: I31a6892b4419947a411b2c4100281d4cf7c50f09 Reviewed-on: https://gerrit.libreoffice.org/68969 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-02-11find-unneeded-includes: Skip headers used only for compile testGabor Kelemen
As proposed in https://gerrit.libreoffice.org/#/c/67473/ Change-Id: Ibbc2d32dde2363502915cfeb036fa6f4ba568932 Reviewed-on: https://gerrit.libreoffice.org/67574 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-01-24find-unneeeded-includes: don't propose to replace o3tl/deleter.hxxGabor Kelemen
As seen while analysing sw/source/core/inc/DocumentChartDataProviderManager.hxx replacing o3tl/deleter.hxx with fw declaration does not work, it compiles only when it is transitively included. This also removes mistakenly added fw declarations and now unnecessary IwyuFilter blacklist items Change-Id: I2d631f0693dbfd0bb0e62218a525113042c9a907 Reviewed-on: https://gerrit.libreoffice.org/66750 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-01-17find-unneeded-includes: don't propose debug/bitset eitherGabor Kelemen
Found while checking include/vcl/fontcapabilities.hxx Change-Id: Ib598978672d08d3cae7bf6f96d1b874ca13fcb5f Reviewed-on: https://gerrit.libreoffice.org/66254 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-01-11find-unneeded-includes: don't propose cmath -> bits/std_abs.hGabor Kelemen
Found while cleaning sd/source/ui/sidebar/PageMarginUtils.hxx Change-Id: Iccbd45d9c53dd6561a6161f9949d6fb9d8539514 Reviewed-on: https://gerrit.libreoffice.org/65923 Tested-by: Jenkins Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
2018-12-11find-unneeded-includes: Avoid proposing o3tl fw declarationGabor Kelemen
This does not really work: even when it seems to, it compiles only because of transitive includes - Filter o3tl/typed_flags_set.hxx in f-u-u - Remove already added fw declarations from hxx files and include full header just in case - Remove now unnecessary blacklist entries Change-Id: Ie0de6667af697095a623b435806449e7e28a6004 Reviewed-on: https://gerrit.libreoffice.org/64659 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-11-13find-unneeded-includes: sort the outputGabor Kelemen
Default IWYU output is sorted alphabetically by filename A more friendly way to present f-u-i information would be to sort by line numbers: so that a developer can go through the removal proposals in the editor top to bottom, without too much cursor positioning in the list of 100 header lines to delete 20 of them. The result is not perfect, because numbers in text are not naturally sorted: line 205 will be listed between 20 and 21; but that's a really rare occasion Change-Id: I8011321a299a76f5a32469a9d77eb8fcc4521034 Reviewed-on: https://gerrit.libreoffice.org/63144 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-10-25sw: fix some IWYU warningsMiklos Vajna
Change-Id: Ic7e6aa31e5c6d210101da7223a294092ab5b7481 Reviewed-on: https://gerrit.libreoffice.org/62334 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-13find-unneeded-includes: do not propose css/uno .hxx to .h replacementsGabor Kelemen
Better to not replace stable API headers with implementation details Change-Id: I66c7a237b1df13b7aa2523eba87d45d123621a95 Reviewed-on: https://gerrit.libreoffice.org/61742 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-08find-unneeded-includes: warn about fw decls in namespaces tooGabor Kelemen
This regex parsed unneeded fw declarations reported by IWYU in the form of: class foo; But not ones inside namespaces, e.g.: namespace foo { class bar; } namespace com { namespace sun { namespace star { namespace foo { class bar; } } } } Change-Id: Ie2962b9fb1cf9382e8da45903f3716d0311dd58e Reviewed-on: https://gerrit.libreoffice.org/61485 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-21find-unneeded-includes: Don't propose functional -> bits/std_function.hGabor Kelemen
As seen for include/comphelper/doublecheckedinit.hxx - won't compile anyways Change-Id: I3a0d5e115ecfc61ae90c6e843ecf4f0213b76e82 Reviewed-on: https://gerrit.libreoffice.org/60838 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-12IWYU: ignore UNO include files, similar to how the clang loplugin doesMiklos Vajna
Otherwise we could break some external code for no good reason. Change-Id: I01b1e266425688d3d4b5293c0f8609d78c6b7f2f Reviewed-on: https://gerrit.libreoffice.org/60331 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-07-05find-unneeded-includes: stop proposing internal libstdc++ headersGabor Kelemen
They wouldn't really compile anyways and only cause unnecessary blacklist entries. Some '- memory' entries can already be removed from the blacklists. Change-Id: Iab53d5a57121f61abe935e712dc23a55390235bf Reviewed-on: https://gerrit.libreoffice.org/56979 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-05-23find-unneeded-includes: Make the output user friendlierGabor Kelemen
This way it's easy to copy-paste the problematic command for further investigation of IWYUs proposals Change-Id: I9e7403f0f05e64e562441941f00127a62bf15265 Reviewed-on: https://gerrit.libreoffice.org/54560 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-04-25sw: fix remaining IWYU warnings in inc/*.hxxMiklos Vajna
Also check for not needed forward declarations. Change-Id: I92759f3f40d9458fd192665b39b87a78d8b97e5a Reviewed-on: https://gerrit.libreoffice.org/53418 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-04-23Fix typo in variableAndrea Gelmini
Change-Id: I9ff961e9d6558478e72098a74048a5957299a953 Reviewed-on: https://gerrit.libreoffice.org/52547 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-04-07Add IWYU wrapper script to find unused includesMiklos Vajna
I've used this script in the recent past to fix warnings in mostly sw/inc/*.hxx. Hopefully sharing it creates interest for others to do similar fixes in other modules. Change-Id: I4c8b6a1e92b006d4fd56b403a25715f11964d639 Reviewed-on: https://gerrit.libreoffice.org/52289 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>