57 Commits

Author SHA1 Message Date
Noel Grandin
4c945b22fc new loplugin:methodcycles
look for closed cycles of methods i.e. unused code that would not
otherwise be found by the unusedmethods loplugin

Change-Id: I3fb052132d97aabca573bb8e9fc424201b1e2042
Reviewed-on: https://gerrit.libreoffice.org/60875
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-21 18:44:29 +02:00
Noel Grandin
b40e57f403 fix loplugin:unusedmethods
revert the part of
    commit 9f4d23c15115d64febd6bf01f870cc157badd350
    Date:   Mon Aug 13 17:24:26 2018 +0200
    filter out some of the AST in the plugins
that applied to this plugin. Turns out it really needs to see __all__
the code in order to produce good results.

Change-Id: If580a701049d2570f2a833327b2189641090079b
Reviewed-on: https://gerrit.libreoffice.org/60279
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-11 08:18:16 +02:00
Noel Grandin
9f4d23c151 filter out some of the AST in the plugins
by checking if the current namespace decl is in our code, so we have to
scan less stuff, which results in a 10% perf improvement for me

Change-Id: Idf0e30d57b6d0dcd13daa9ed679c28b9d233d387
Reviewed-on: https://gerrit.libreoffice.org/58942
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-14 13:02:14 +02:00
Noel Grandin
64a5d65f4c put the loplugin output files in the workdir
so that the next time I accidentally leave one turned on, and commit it,
the buildbots will clean up naturally the next time they run 'make
clean'

Change-Id: Ia09dea9c272c322c7e2773c5458cb54aceb50dd1
2018-04-10 15:54:24 +02:00
Stephan Bergmann
9663341f92 Bump --enable-compiler-plugins to Clang 3.8.0
<https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html>
"Clang baseline bump"

Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7
Reviewed-on: https://gerrit.libreoffice.org/46557
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-19 22:08:38 +01:00
Noel Grandin
d43e694d5e some global loplugin improvements
for some reason we're hitting more template AST nodes now? Anyhow,
updated singlevalfields and unusedenumconstants to cope.

For unusedfields, ignore field access inside Clone() methods, since it's
like a constructor.
Similarly for unusedmethods.

Change-Id: Icb2f76fb2f06ae5df21f9d75312e42a2800befb9
Reviewed-on: https://gerrit.libreoffice.org/45470
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-30 07:20:23 +01:00
Stephan Bergmann
9f4491477b Add back UnusedMethods::TraverseCXXDeductionGuideDecl, properly ifdef'ed
...as is already done in 65d6c642590bd5f51c04228d941608322a85f1ac
"loplugin:casttovoid".  (This reverts 5eec6db4addd7cc665222e1a4d05c35b13719847
"fix loplugin unusedmethods".)

Change-Id: Ibe6a7d9ce58aa70707538854ac64ad07022ea7b6
Reviewed-on: https://gerrit.libreoffice.org/45388
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-28 14:09:25 +01:00
Noel Grandin
5eec6db4ad fix loplugin unusedmethods
VisitCXXDeductionGuide is not part of our baseline clang

Change-Id: I354a992456949975384d8ae1a81a07de9e886061
2017-11-28 10:31:54 +02:00
Noel Grandin
ac50f685c7 loplugin:unusedmethods ignore recursive calls
Change-Id: I651a7bf0c705acc5580af8b7742d2d035ec64388
2017-11-28 08:29:13 +02:00
Noel Grandin
4cc7ebcca3 loplugin:unusedmethods new analysis
look for classes containing protected methods where we can convert them
all to private

Change-Id: I4a448341943e0a613cde30501c4012da61dba713
Reviewed-on: https://gerrit.libreoffice.org/44588
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-10 15:19:04 +01:00
Noel Grandin
32823280ef loplugin:unusedmethods
Change-Id: I543b0943f0bc918d59debc8ee051f88c29d18454
Reviewed-on: https://gerrit.libreoffice.org/44553
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-10 12:56:14 +01:00
Stephan Bergmann
b35bb38f18 Clean away temporarily added using declarations
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-11-07 11:50:47 +01:00
Noel Grandin
5585bc2fbb rename loplugin::Plugin::parentStmt
to getParentStmt and rename parentFunctionDecl to getParentFunctionDecl,
so I don't keep using accidentally naming my variables the same as the
functions.

Change-Id: I66f9452458c8b439e5132191ac5219fb6d420708
2017-10-27 10:31:42 +02:00
Noel Grandin
4c0198b02c reformat some loplugin code
to match our more normal conventions.

Also drop the 'using std' and some other cruft

Change-Id: I02ef81c5427188bc03a20b157a57a900a9d7bf0d
2017-06-20 10:26:46 +02:00
Noel Grandin
6f9cdf0814 can-be-private analysis needs to ignore virtual methods
Change-Id: I1e2f28ed550ff9751912f70e3eec511ddc5b75cf
2016-11-22 08:34:16 +02:00
Noel Grandin
92da39d5f9 update couple of loplugins for move constructors
Change-Id: I82140569a3e09225065d721e4aeac5c5fe93bc45
2016-11-16 14:16:09 +02:00
Stephan Bergmann
7eea236a24 -Werror=unused-function
Change-Id: I9e0585460d908024f75a1134bc1cd20d12ea3b4e
2016-10-18 09:12:27 +02:00
Noel Grandin
40fd53a238 loplugins: extract some common functionality
Change-Id: If470e1d9b481c9eda0829aa985152baf8fb46d7a
2016-10-18 08:51:07 +02:00
Noel Grandin
281fa6ac6a some cleanups to the unusedmethods loplugin
- publicDefinitionSet is unnecessary, the python post-processor does not
need it
- remove the traversing of templates, clang will do that for us since we
have set the shouldVisitTemplateInstantiations() method

Change-Id: I0e96dad0b1cc941fe6c4a2e9227e86d8c3f1d85a
2016-10-18 08:51:07 +02:00
Noel Grandin
3468dab9ff clang plugins: do "dotdot" normalisation
which fixes some false positives

Change-Id: I555349180b5ca819f29695789f1545ba2177bd09
Reviewed-on: https://gerrit.libreoffice.org/29320
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-27 12:08:52 +00:00
Noel Grandin
1c15a20df8 loplugin:unusedmethods unused returns
Change-Id: I4da3374e31d3c7407b401d66275da7f56ae83d30
Reviewed-on: https://gerrit.libreoffice.org/29178
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-22 13:13:05 +00:00
Noel Grandin
98c90acdfc loplugins: more consistent naming of output files
Change-Id: Ia26f697cb16078f235c94e4cff449a60c1bbd74e
2016-07-25 13:23:10 +02:00
Stephan Bergmann
9308f35318 Adapt to Clang 3.4 (in preparation of a buildbot on CentOS 7)
Change-Id: Ie2859f03b31c57deb7fd0deba3285f782e33b239
2016-06-28 16:26:33 +02:00
Noel Grandin
442dd6a153 loplugin: move parentFunctionDecl() into common code
Change-Id: Ia10a76a98a63c6ea3b516d9146281f672b213ab3
2016-06-28 14:53:17 +02:00
Stephan Bergmann
f8a18a464e Adpat to <https://llvm.org/svn/llvm-project/cfe/trunk@273647>
"Use more ArrayRefs"

Change-Id: Ied0ab11dd9366b3f499100b2627f4919cca52c9c
2016-06-24 16:46:55 +02:00
Stephan Bergmann
2712fc0869 I assume these special plugins were not intended to be enabled unconditionally
...with fa135fd0e05fc4ba784b4349d65f2e5ed26c0f55 "remove unused SID constants
and associated code"

Change-Id: I51b2a9e3c8ce13401818bca0c40167a4364212f1
2016-06-02 23:46:46 +02:00
Noel Grandin
fa135fd0e0 remove unused SID constants and associated code
found with a python script that looks like:

process = subprocess.Popen(
  "git ls-files *.hrc | xargs grep -hE '#define +SID_' | cut -d ' ' -f 2 | sort -u",
  shell=True, stdout=subprocess.PIPE)
for line in iter(process.stdout.readline, b''):
  line = line.strip()
  if line.startswith("//"): continue
  if line.startswith("sfx"): continue
  if len(line) < 10: continue
  i = subprocess.check_output("git grep -nP \"#define +" + line + " \"",
                              shell=True)
  if i.count("#define") < 2: continue
  print line + "
" + i

Change-Id: I40eac2569c2b5b129d9459cb723a9d6f26d09264
Reviewed-on: https://gerrit.libreoffice.org/25715
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-06-01 06:48:13 +00:00
Noel Grandin
d59125638b update unusedmethods plugin to ignore externC and copy constructors
Change-Id: Idf7a9403d313ba6a0e031c59601e20c880b6118b
2016-05-18 16:38:23 +02:00
Noel Grandin
2c8fe2e737 update unusedmethods plugin to deal with constructors
and fix the operator< implementations in some of the other
plugins too.

Change-Id: Ie5631e0cdc8d2a994ad2af2533cdb558a6cfc035
Reviewed-on: https://gerrit.libreoffice.org/25057
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-18 10:03:44 +00:00
Stephan Bergmann
01f3b95884 These version checks are about the Clang the plugins are built /against/
...not the (Clang) compiler they are being built /with/.  (Also simplifies the
checking #if code.)

Change-Id: I416321be4ef4478785be40571f81500fd3b6feb8
2016-02-26 14:34:29 +01:00
Noel Grandin
4fbf95deba new loplugin:unuseddefaultparams
Change-Id: I2c3e7d66be9e3883ea2801ff394948cc580d1e44
2016-02-25 11:42:35 +02:00
Andrea Gelmini
534b2a4b58 Fix typos
Change-Id: Ice72f8d9971e15dd6ef365e64cd567b8581a92d3
Reviewed-on: https://gerrit.libreoffice.org/21797
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-05 06:48:38 +00:00
Noel Grandin
d34d792230 new loplugin to find public methods that can be private
based on the unusedmethods plugin, which I should probably rename at
some point

Change-Id: If197423c59d4350ea1fdc69e99d24b631d9751b9
2016-02-01 14:53:19 +02:00
Noel Grandin
a7f6efc68b loplugin: unused return values
Change-Id: I9c61a46c57894bc63a57740206c0bcb4a16553af
Reviewed-on: https://gerrit.libreoffice.org/21571
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-18 12:50:09 +00:00
Noel Grandin
86bb6fdf9c update unusedmethods loplugin to update unused return values
Change-Id: I825d022d09282bc9b6cffd9178e40e4090d335da
2016-01-11 10:49:24 +02:00
Noel Grandin
e18b08363a loplugin:unusedmethods
Change-Id: Ifafdaf6da0225f244853a0042a6458643b570623
2015-12-21 10:20:31 +02:00
Noel Grandin
644487a115 loplugin:unusedmethods
Change-Id: I161cd52606c11b6008f5d8b1d8ee391692f91861
Reviewed-on: https://gerrit.libreoffice.org/19231
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-27 08:20:43 +00:00
Noel Grandin
3ce9af420a loplugin:unusedmethods
Change-Id: I73180266c0af98dbd8d29bd3b11850996b94def9
Reviewed-on: https://gerrit.libreoffice.org/19195
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2015-10-27 02:33:18 +00:00
Noel Grandin
7e776c0027 loplugin:unusedmethods
Change-Id: I150baadc442e57ee604563bc52965daa9d2e41af
2015-10-06 10:17:02 +02:00
Noel Grandin
58aea3f36c loplugin:unusedmethods
- improvements to the plugin to find more method calls
- improvements to python script to remove more false+
- fix the FORCE_COMPILE_ALL build flag to include code in
  the $WORKDIR

Change-Id: I4d6015dcb9b9d60c26f0bcee8abad807177a7836
Reviewed-on: https://gerrit.libreoffice.org/19064
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-01 10:43:24 +00:00
Noel Grandin
34180700b2 loplugin:removeunusedmethods, remove unused stuff
Change-Id: I35456b2a3ad2a84a1d045f09cdfb29e4c19b8350
2015-09-29 15:08:43 +02:00
Noel Grandin
403c13487c loplugin:unusedmethods
Change-Id: I6801618efb5a66d24156fa429e026acb6ca03aba
Reviewed-on: https://gerrit.libreoffice.org/17506
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-08-05 09:39:22 +00:00
Noel Grandin
38023af6c1 loplugin:unusedmethods
Change-Id: If5090c330e12d6e537766bf4a9be0a2360381a7a
Reviewed-on: https://gerrit.libreoffice.org/17312
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-24 10:36:20 +00:00
Noel Grandin
96d44c9b07 loplugin:unusedmethods sc
Change-Id: I7bdb1889a942d63370731764a58f4ab524dedd8a
Reviewed-on: https://gerrit.libreoffice.org/17287
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-22 13:02:57 +00:00
Noel Grandin
f3872352b3 fix my previous commit
Change-Id: I287d99a46eda90718a3c4ec2c92f7b063babeb24
2015-07-21 14:43:01 +02:00
Noel Grandin
07645b443a workaround clang-3.5 issue in unusedmethods loplugin
Change-Id: Ie67518536932e24e9cff7a8b75b42e90e9f67673
2015-07-21 14:39:35 +02:00
Noel Grandin
e103bf6cfd loplugin:unusedmethods dbaccess
Change-Id: Ifa16acc6d90ebd4f56c5662959010f6228228cb5
Reviewed-on: https://gerrit.libreoffice.org/17209
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-20 11:56:11 +00:00
Noel Grandin
9f4f237a38 loplugin:unusedmethods svl
Change-Id: If86cc43fda4d138cf7f678d81fa2b35f68f3c03b
Reviewed-on: https://gerrit.libreoffice.org/17162
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-20 06:33:44 +00:00
Noel Grandin
5a7bf1b32c loplugin:unusedmethods slideshow
Change-Id: I66b6cddb638a9fc1228d3ea9df5d112300a00eb3
Reviewed-on: https://gerrit.libreoffice.org/17128
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-17 06:49:23 +00:00
Noel Grandin
4ca2cf1b7e loplugin:unusedmethods sfx2
Change-Id: I98c455d89f76fbcacf74929a4e8775b4da697f62
Reviewed-on: https://gerrit.libreoffice.org/17069
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-16 05:47:52 +00:00