summaryrefslogtreecommitdiffstats
path: root/bin/find-unneeded-includes
Commit message (Collapse)AuthorAgeFilesLines
* Remove some unused includesMiklos Vajna2020-09-021-1/+5
| | | | | | | Change-Id: I90d4e3db3eefa41f8492cfe23c5088ea93134afc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101890 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
* Fix typoAndrea Gelmini2020-07-121-1/+1
| | | | | | | Change-Id: Ib728bcd332400df7e6c5466387fcdbda97792382 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98489 Tested-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
* replace usage of blacklist with excludelist for IWYUThorsten Behrens2020-07-101-5/+5
| | | | | | | | | | Background and motivation: https://tools.ietf.org/html/draft-knodel-terminology-02 Change-Id: I2f22d455d2a936a85750eaab1fda215ebb6d9d48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98182 Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
* Drop o3tl::optional wrapperStephan Bergmann2020-02-211-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...now that macOS builds are guaranteed to have std::optional since 358146bbbd1b9775c12770fb5e497b6ec5adfc51 "Bump macOS build baseline to Xcode 11.3 and macOS 10.14.4". The change is done mostly mechanically with > for i in $(git grep -Fl optional); do > sed -i -e 's:<o3tl/optional\.hxx>\|\"o3tl/optional\.hxx\":<optional>:' \ > -e 's/\<o3tl::optional\>/std::optional/g' \ > -e 's/\<o3tl::make_optional\>/std::make_optional/g' "$i" > done > for i in $(git grep -Flw o3tl::nullopt); do > sed -i -e 's/\<o3tl::nullopt\>/std::nullopt/g' "$i" > done (though that causes some of the resulting #include <optional> to appear at different places relative to other includes than if they had been added manually), plus a few manual modifications: * adapt bin/find-unneeded-includes * adapt desktop/IwyuFilter_desktop.yaml * remove include/o3tl/optional.hxx * quote resulting "<"/">" as "&lt;"/"&gt;" in officecfg/registry/cppheader.xsl * and then solenv/clang-format/reformat-formatted-files Change-Id: I68833d9f7945e57aa2bc703349cbc5a56b342273 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89165 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
* find-unneeded-includes: silence broken o3tl::optional -> std::optional proposalMiklos Vajna2020-02-131-1/+4
| | | | | | | | | This is just a workaround, see the upstream bugreport for the details. Change-Id: I2334fb3ad86db7f43bd49c694eea3c240316bfa0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88566 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
* find-unneeded-includes: ignore extra recommendationsGabor Kelemen2019-10-041-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | When IWYU is used to check cxx files it also checks associated hxx (but for .hxx -> .h too) files too and gives addition/removal recommendations There is no documented way of disabling this. Currently f-u-i does not differentiate between recommendations for the checked file and its header and prints everything. Which means sometimes I need to update .hxx files or blacklist warnings that interestingly are not shown when the same .hxx is checked with IWYU. The worst example is ucb/source/ucp/ftp/curl.hxx where IWYU gives recommendations for /usr/include/x86_64-linux-gnu/curl/curl.h Remedy this with considering the full filename + should add these lines: / should remove these lines: string as beginning of interesting recommendations Also remove some now obsolete blacklist entries from yaml files Change-Id: I1d139536992e4b56c699c31a4cc6491d373c2002 Reviewed-on: https://gerrit.libreoffice.org/80172 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
* find-unneeded-includes: warn first time user nicely about missing fileGabor Kelemen2019-07-291-2/+6
| | | | | | | Change-Id: Ibc0b818a410cf0aee19b1d2a42a53db9aff87638 Reviewed-on: https://gerrit.libreoffice.org/76461 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
* find-unneeded-includes: raise maximum output line lengthGabor Kelemen2019-07-151-1/+1
| | | | | | | | | | | | | | | | 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>
* find-unneeded-includes: don't propose to replace hpp with hdl...Gabor Kelemen2019-07-151-2/+2
| | | | | | | | | 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>
* find-unneeded-includes: show command line in case of IWYU error messagesGabor Kelemen2019-06-171-1/+8
| | | | | | | | | | 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>
* find-unneeded-includes: don't propose to replace boost/functional/hash.hppGabor Kelemen2019-06-121-0/+2
| | | | | | | | | 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>
* find-unneeded-includes: don't propose to remove <map>...Gabor Kelemen2019-06-031-1/+1
| | | | | | | | | | | ..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>
* find-unneded-includes: don't suggest removal of fwd declsMiklos Vajna2019-05-311-12/+4
| | | | | | | | | | | | | | | | | | | | | 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
* find-unneded-includes: avoid replacing includes with forward-declarationsMiklos Vajna2019-05-311-1/+1
| | | | | | | | | | | | | | | | 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>
* find-unneeded-includes: dont propose to replace cstdint with internal headerGabor Kelemen2019-05-091-1/+2
| | | | | | | | | 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>
* find-unneeded-includes: filter out boost/unordered_map.hppGabor Kelemen2019-05-091-0/+2
| | | | | | | | | | | 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>
* find-unneeded-includes: dont propose to replace ctime with internal headerGabor Kelemen2019-05-081-1/+2
| | | | | | | | | 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>
* find-unneeded-includes: don't try to replace forward_list with debug headerGabor Kelemen2019-05-061-0/+1
| | | | | | | | | 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>
* find-unneeded-includes: fix tuple default items in debugStlGabor Kelemen2019-04-091-8/+8
| | | | | | | | | | | 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>
* find-unneeded-includes: filter out boost/variant.hppGabor Kelemen2019-04-031-0/+2
| | | | | | | | | | 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>
* find-unneeded-includes: use a better data structureGabor Kelemen2019-04-021-13/+14
| | | | | | | | | | | | | | | 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>
* find-unneeded-includes: don't try to fw. declare o3tl/span.hxxGabor Kelemen2019-03-221-0/+1
| | | | | | | | | | 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>
* find-unneeded-includes: don't propose debug/set.h if multiset is usedGabor Kelemen2019-03-181-0/+1
| | | | | | | | | 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>
* find-unneeded-includes: Skip headers used only for compile testGabor Kelemen2019-02-111-0/+5
| | | | | | | | | 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>
* find-unneeeded-includes: don't propose to replace o3tl/deleter.hxxGabor Kelemen2019-01-241-0/+1
| | | | | | | | | | | | | | | 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>
* find-unneeded-includes: don't propose debug/bitset eitherGabor Kelemen2019-01-171-0/+1
| | | | | | | | | 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>
* find-unneeded-includes: don't propose cmath -> bits/std_abs.hGabor Kelemen2019-01-111-0/+1
| | | | | | | | | 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>
* find-unneeded-includes: Avoid proposing o3tl fw declarationGabor Kelemen2018-12-111-0/+8
| | | | | | | | | | | | | | | 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>
* find-unneeded-includes: sort the outputGabor Kelemen2018-11-131-1/+1
| | | | | | | | | | | | | | | | | 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>
* sw: fix some IWYU warningsMiklos Vajna2018-10-251-0/+3
| | | | | | | Change-Id: Ic7e6aa31e5c6d210101da7223a294092ab5b7481 Reviewed-on: https://gerrit.libreoffice.org/62334 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* find-unneeded-includes: do not propose css/uno .hxx to .h replacementsGabor Kelemen2018-10-131-0/+11
| | | | | | | | | 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>
* find-unneeded-includes: warn about fw decls in namespaces tooGabor Kelemen2018-10-081-1/+1
| | | | | | | | | | | | | 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>
* find-unneeded-includes: Don't propose functional -> bits/std_function.hGabor Kelemen2018-09-211-0/+1
| | | | | | | | | 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>
* IWYU: ignore UNO include files, similar to how the clang loplugin doesMiklos Vajna2018-09-121-0/+16
| | | | | | | | | 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>
* find-unneeded-includes: stop proposing internal libstdc++ headersGabor Kelemen2018-07-051-0/+9
| | | | | | | | | | | 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>
* find-unneeded-includes: Make the output user friendlierGabor Kelemen2018-05-231-1/+1
| | | | | | | | | | 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>
* sw: fix remaining IWYU warnings in inc/*.hxxMiklos Vajna2018-04-251-1/+8
| | | | | | | | | 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>
* Fix typo in variableAndrea Gelmini2018-04-231-1/+1
| | | | | | | Change-Id: I9ff961e9d6558478e72098a74048a5957299a953 Reviewed-on: https://gerrit.libreoffice.org/52547 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
* Add IWYU wrapper script to find unused includesMiklos Vajna2018-04-071-0/+233
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>