Commit Graph

2105 Commits

Author SHA1 Message Date
Noel Grandin
1b5dae25b0 loplugin:unnecessaryvirtual
Change-Id: Ib329e251ee405f60568a2fea6cb93f54a84063cd
Reviewed-on: https://gerrit.libreoffice.org/80144
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03 17:49:41 +02:00
Noel Grandin
9db8406b83 loplugin:virtualdead
Change-Id: I86bae18ed2682871032aeb2a178f49f3e4601129
Reviewed-on: https://gerrit.libreoffice.org/80129
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03 16:34:45 +02:00
Noel Grandin
09f77e8ed5 loplugin:unusedmethods
Change-Id: I9790d053248ae6bd58ecc026c774014c4e5e04aa
Reviewed-on: https://gerrit.libreoffice.org/80115
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03 16:34:31 +02:00
Noel Grandin
77e9216ca1 loplugin:unusedfields
and filter out the weld fields, since we're not touching them yet

Change-Id: I3cc23c46d2650f13cb29c7d381687939d23e2882
Reviewed-on: https://gerrit.libreoffice.org/80104
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03 12:16:38 +02:00
Noel Grandin
b3b8288f7f new loplugin:stringadd
look for places where we can replace sequential additions to
OUString/OString with one concatentation (i.e. +) expression, which is
more efficient

Change-Id: I64d91328bf64828d8328b1cad9e90953c0a75663
Reviewed-on: https://gerrit.libreoffice.org/79406
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-02 11:22:27 +02:00
Stephan Bergmann
9d99dc8a83 -Werror,-Winconsistent-missing-override
Change-Id: I4cfb01582e5cfef55909ae56fd14ce8ccd5c14be
Reviewed-on: https://gerrit.libreoffice.org/79990
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-02 08:19:26 +02:00
Stephan Bergmann
152b3ef0f3 loplugin:noexceptmove: Cater for null FunctionDecl::getBody
...which can happen for function templates with clang-cl, leading to false
warnings like

> [build CXX] codemaker/source/commoncpp/commoncpp.cxx
> In file included from codemaker/source/commoncpp/commoncpp.cxx:25:
> In file included from include\codemaker/typemanager.hxx:28:
> include\rtl/ref.hxx(126,5): error: move operator= can be noexcept [loplugin:noexceptmove]
>     Reference<reference_type> &
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I541c7c3d86d05964834e3e5cf678c8f1145ea132
Reviewed-on: https://gerrit.libreoffice.org/79956
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 21:41:44 +02:00
Stephan Bergmann
1028841feb Silence a supposedly unproblematic loplugin:badstatics (clang-cl)
Change-Id: I9c76fb4aca21757a0bf033103bd6dc2bea740eb5
Reviewed-on: https://gerrit.libreoffice.org/79932
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 17:36:39 +02:00
Stephan Bergmann
ede6b3a780 Remove spurious #include <unistd.h>
(which appears to be unused and caused compilation failure on Windows)

Change-Id: Ice6882d98da3bac1f53e869b73ab179df93280fa
Reviewed-on: https://gerrit.libreoffice.org/79925
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 15:13:43 +02:00
Stephan Bergmann
6d9203b351 Use loplugin::isSamePathname (as needed on Windows)
Change-Id: I8a1df1c64a93dc3e4a6fb00afd11aaf8521ecea4
Reviewed-on: https://gerrit.libreoffice.org/79926
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01 13:32:00 +02:00
Noel Grandin
4609082699 new loplugin:duplicate-defines
Change-Id: I98e17e0a92ae5d51778b9a72c679ed262a6f5cb0
Reviewed-on: https://gerrit.libreoffice.org/79826
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-30 10:25:13 +02:00
Noel Grandin
1820fcbbc3 constmethod for accessor-type methods
Apply the constmethod plugin, but only to accessor-type methods, e.g.
IsFoo(), GetBar(), etc, where we can be sure of that
constifying is a reasonable thing to do.

Change-Id: Ibc97f5f359a0992dd1ce2d66f0189f8a0a43d98a
Reviewed-on: https://gerrit.libreoffice.org/74269
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-29 12:43:37 +02:00
Noel Grandin
664f8632b1 loplugin:virtualdead in basegfx
Change-Id: I8b3f7810eb08b5217df30b7be27aafadeeed247a
Reviewed-on: https://gerrit.libreoffice.org/79647
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28 17:56:57 +02:00
Noel Grandin
ef98596d62 loplugin:virtualdead in chart2
Change-Id: Ia24e5072cf4d16e8a437323fa7fd5ab5207e71d2
Reviewed-on: https://gerrit.libreoffice.org/79645
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28 17:56:49 +02:00
Noel Grandin
c1e31ee043 loplugin:virtualdead in dbaccess
Change-Id: I030283816185f42f9012c8dfb2d745164abd7234
Reviewed-on: https://gerrit.libreoffice.org/79644
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28 13:46:26 +02:00
Noel Grandin
616d47dbbe loplugin:virtualdead in basctl
Change-Id: I6a3f74a3c52f3fb97b26de69b20ffd7502968d5e
Reviewed-on: https://gerrit.libreoffice.org/79646
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28 13:46:14 +02:00
Noel Grandin
dd5947b852 loplugin:virtualdead in editeng
Change-Id: I72f9cf62f9daeaed5108ede41dd41544204a9745
Reviewed-on: https://gerrit.libreoffice.org/79643
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28 08:59:30 +02:00
Noel Grandin
8de4e81b0c loplugin:virtualdead in extensions
Change-Id: I953ceaccf6c7d0cfe1f98006a6ed00544399ef97
Reviewed-on: https://gerrit.libreoffice.org/79642
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28 08:59:07 +02:00
Noel Grandin
146e998508 loplugin:virtualdead in sd
Change-Id: Idca2a3a53c4b79ba21a3113da63a8a96d8b2cd81
Reviewed-on: https://gerrit.libreoffice.org/79641
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27 21:09:20 +02:00
Noel Grandin
5e1b57b8e6 loplugin:virtualdead in slideshow
Change-Id: Ie158b76e6d552b1189173e30fbea5a43a774180b
Reviewed-on: https://gerrit.libreoffice.org/79640
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27 19:35:05 +02:00
Noel Grandin
4b995afda3 loplugin:virtualdead in svl
Change-Id: Idbb5d0a633f12d5813561a2ad8aed46ec6d67c48
Reviewed-on: https://gerrit.libreoffice.org/79639
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27 14:50:11 +02:00
Noel Grandin
c0731052db loplugin:virtualdead in svx
Change-Id: I8af09a2f0a4a8c7952c5855b2934f2d0a64d9740
Reviewed-on: https://gerrit.libreoffice.org/79638
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27 08:33:58 +02:00
Noel Grandin
5a1163c202 loplugin:virtualdead filter out some more stuff
in the post-processing step

Change-Id: I5c57f9ded6a52d541694c5972656e33bb7771de6
Reviewed-on: https://gerrit.libreoffice.org/79637
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26 20:16:45 +02:00
Noel Grandin
250c2ec78b loplugin:virtualdead in vcl
Change-Id: I54cacce6d843f41f220ac5350868bd6d70dbc6b4
Reviewed-on: https://gerrit.libreoffice.org/79585
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26 20:13:30 +02:00
Noel Grandin
352bcf4114 loplugin:virtualdead in sw(2)
Change-Id: Ib948148fa21d595faa8a4a86d4f47243755885ee
Reviewed-on: https://gerrit.libreoffice.org/79588
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26 16:57:49 +02:00
Noel Grandin
464fe63e33 loplugin:virtualdead in sw
Change-Id: Ib96caad8a2bbfc4ff9a5191abbd49789d142d2eb
Reviewed-on: https://gerrit.libreoffice.org/79587
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26 14:05:52 +02:00
Noel Grandin
e7a1d057c4 new loplugin virtualdead
to look for virtual methods where all of the implementations of that
method do nothing useful

Change-Id: I623456ade1c55fe8048d23f69cb692540378daa4
Reviewed-on: https://gerrit.libreoffice.org/79579
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26 08:04:37 +02:00
Noel Grandin
b722989678 loplugin:unnecessaryvirtual
Change-Id: I866d7bd03a41260a9b4f4be87a7a02d3ceecc1c7
Reviewed-on: https://gerrit.libreoffice.org/79534
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26 03:04:12 +02:00
Stephan Bergmann
3a7d479c4c Improve loplugin:sequenceloop diagnostic advice
"make range var const" sounded to me like it talked about the variable declared
in the for-range-declaration, not a variable referenced in the for-range-
initializer

Change-Id: Ie777e1374ead7f37c8efb022cd87e980d2ee9810
Reviewed-on: https://gerrit.libreoffice.org/79563
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-25 22:14:02 +02:00
Luboš Luňák
2f5f45921b support O(U)String::number() for fast string concatenation
When I did the fast string concatenation, I didn't add any support
for number(), which simply returned a O(U)String, and so it did
the extra allocation/deallocation, although that could be avoided.
In order to support this, number() now returns a special temporary
return type, similarly to O(U)StringConcat, which allows delaying
the concatenation the same way.
Also similarly, the change of the return type in some cases requires
explicit cast to the actual string type. Usage of OString::getStr()
is so extensive in the codebase that I actually added it to the helper
class, after that it's only relatively few cases.

Change-Id: Iba6e158010e1e458089698c426803052b6f46031
Reviewed-on: https://gerrit.libreoffice.org/78873
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-09-24 12:58:14 +02:00
Luboš Luňák
a7d40f5754 compiler check for rtl::OUStringConcat instances
Something like auto str = "string" + OUString::number( 10 ); will
not be OUString but actually rtl::OUStringConcat (which gets implicitly
converted to OUString, but not with auto). Since those refer to temporaries
from the expression, they should not outlive the expression.

Change-Id: Ib4cde4b38befb3d49927d0cf01c52ebb2d36df89
Reviewed-on: https://gerrit.libreoffice.org/78830
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-09-24 12:53:39 +02:00
Luboš Luňák
db123abade rebuild sharedvisitor.cxx if any of its sources disappears
Testcase: Remove any reference to LO_CLANG_SHARED_PLUGINS from e.g.
blockblock.cxx, sharedvisitor.cxx should get regenerated.

Change-Id: Iddff3cf41c223cfdf161060d29bde9df1df7b702
Reviewed-on: https://gerrit.libreoffice.org/79194
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-09-20 10:48:02 +02:00
Noel Grandin
82572caae4 improve and enable loplugin:fragiledestructor
Where the problem was benign and the class was not extended, I marked
the class as final.
Where the problem was benign and the class was extended, I marked the
relevant callee methods as final.

Other cases were excluded in the plugin.

Change-Id: Idb762fb2206af4e8b534aa35ff77f8368c7909bc
Reviewed-on: https://gerrit.libreoffice.org/79089
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-19 11:42:47 +02:00
Noel Grandin
6e1cb2e9dd disable stringbuffer plugin
as pointed out by mike kaganski:

the 'aCellStr + u"\x0001"' expression gives an OUStringConcat which
holds the references to the strings and doesn't allocate any memory; the
OUStringBuffer has a dedicated overload of append() for the
OUStringConcat, which allocates only once for the combined concat length
and then copies everything from the concat, instead of doing the append
twice for each element... why the strange warning for a more efficient
method?

Change-Id: I6492e99c335e2375cfe78547a87b3079a86890f0
Reviewed-on: https://gerrit.libreoffice.org/79036
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-17 10:13:47 +02:00
Stephan Bergmann
8083ccef37 Fix compilerplugins for macOS again
...in the same spirit as how COMPILER_PLUGINS_TOOLING_ARGS had been introduced
with ad7e2af4ed "Allow to pass additional options
into generator's clang::tooling":  For one,
ceb26770b3 "split clangplugins sharedvisitor
generator into two steps" should have passed COMPILER_PLUGINS_TOOLING_ARGS only
into the analyzer and not into the generator executable, while for another, at
least my local build failed with

> [PCH] compilerplugins/clang/sharedvisitor/clang.pch
> In file included from /Users/stephan/Software/lo/core/compilerplugins/clang/sharedvisitor/precompiled_clang.hxx:12:
> In file included from /Users/stephan/Software/lo/core/compilerplugins/clang/sharedvisitor/../plugin.hxx:15:
> In file included from /Users/stephan/Software/llvm/inst/include/clang/AST/ASTContext.h:18:
> In file included from /Users/stephan/Software/llvm/inst/include/clang/AST/ASTTypeTraits.h:19:
> In file included from /Users/stephan/Software/llvm/inst/include/clang/AST/Decl.h:16:
> In file included from /Users/stephan/Software/llvm/inst/include/clang/AST/APValue.h:16:
> In file included from /Users/stephan/Software/llvm/inst/include/clang/Basic/FixedPoint.h:19:
> In file included from /Users/stephan/Software/llvm/inst/include/llvm/ADT/APSInt.h:17:
> In file included from /Users/stephan/Software/llvm/inst/include/llvm/ADT/APInt.h:18:
> In file included from /Users/stephan/Software/llvm/inst/include/llvm/Support/Compiler.h:21:
> In file included from /Users/stephan/Software/llvm/inst/bin/../include/c++/v1/new:90:
> In file included from /Users/stephan/Software/llvm/inst/bin/../include/c++/v1/exception:81:
> In file included from /Users/stephan/Software/llvm/inst/bin/../include/c++/v1/cstdlib:85:
> /Users/stephan/Software/llvm/inst/bin/../include/c++/v1/stdlib.h:97:15: fatal error: 'stdlib.h' file not found
> #include_next <stdlib.h>
>               ^~~~~~~~~~

after dc79dc76f1 "make clangplugin analyzer use internally a PCH to speed things up".

Change-Id: I4aa925049dbc145c672cad7cab2043a0f13780fa
Reviewed-on: https://gerrit.libreoffice.org/79028
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-17 09:30:41 +02:00
Stephan Bergmann
d27e70fce2 Avoid some false loplugin:redundantfcast involving std::function and lambdas
Change-Id: Id9a93fb60f957d75450deb93f1461b1d9dacf8ca
Reviewed-on: https://gerrit.libreoffice.org/78860
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-13 09:27:20 +02:00
Stephan Bergmann
005c43025a One more generated file missing from compilerplugins/.gitignore
Change-Id: I19bfb57f842d3c4fbff011c019b637ec1b80314f
Reviewed-on: https://gerrit.libreoffice.org/78826
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-12 11:43:18 +02:00
Stephan Bergmann
343df4dfb7 Adapt compilerplugins/.gitignore
...to ceb26770b3 "split clangplugins sharedvisitor
generator into two steps"

Change-Id: Icee23ea3c130a7f157d6fec0489d0b9d8f03da20
Reviewed-on: https://gerrit.libreoffice.org/78821
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-11 19:27:47 +02:00
Stephan Bergmann
b057f4f8db Adapt compilerplugins.clean
...to ceb26770b3 "split clangplugins sharedvisitor
generator into two steps"

Change-Id: If75495e9d57007bb30e69e74842bcf42457c9ee4
Reviewed-on: https://gerrit.libreoffice.org/78820
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-11 19:27:35 +02:00
Noel Grandin
81fd3bb4d7 loplugin:redundantfcast check for std::function cast
noticed by mike kaganski

Change-Id: I210f6d2655edde74d9256c6147b7d15a88180196
Reviewed-on: https://gerrit.libreoffice.org/78743
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-11 15:33:28 +02:00
Luboš Luňák
dc79dc76f1 make clangplugin analyzer use internally a PCH to speed things up
This generally makes the sharedvisitor performance reasonable.
The only costly thing that remains is compiling the large sharedvisitor.cxx,
which with optimizations takes quite some time, but there's ccache for that.

Change-Id: Iffa5fc9df34cdb5edf1cde34fc558fd007ef8263
Reviewed-on: https://gerrit.libreoffice.org/78569
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-09-06 12:07:23 +02:00
Luboš Luňák
ceb26770b3 split clangplugins sharedvisitor generator into two steps
Analysing all the plugin sources using just one process takes a lot of time,
so split out a separate analyzer tool that'll analyse one source and
print out the data to a .plugininfo file. The generator then will read
all of these and generate sharedvisitor.cxx . This allows parallelising
the expensive analysis.

With this commit sharedvisitor.cxx is no longer included in the repository,
as this and the next commit should make the generation fast enough.

Change-Id: Idfc33c4ea6ccfd84f829b51001c8ddeb0be09961
Reviewed-on: https://gerrit.libreoffice.org/78568
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-09-06 12:06:54 +02:00
Andrea Gelmini
22ef2a15bb Fixing "...."
Change-Id: Id005a7531d546dd43de13b49bcb3e93081c5ad8d
Reviewed-on: https://gerrit.libreoffice.org/78679
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-06 09:15:58 +02:00
Stephan Bergmann
265552e8ab Use compat::IgnoreImplicit
...for reliable results across Clang versions.  Also, there appears to be no
need to check for CXXTemporaryObjectExpr both before and after IgnoreImplicit.

Change-Id: Ib804591b6d50073c99680d0933e21f32bba29342
Reviewed-on: https://gerrit.libreoffice.org/78640
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-05 14:13:33 +02:00
Noel Grandin
9dac199094 loplugin:noexceptmove improve feedback
Change-Id: I16612abd535812bdb9d46aa9886b1e02747aab6f
Reviewed-on: https://gerrit.libreoffice.org/78614
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-05 08:27:43 +02:00
Szabolcs Toth
5bfa8b8d5e tdf#118314 Code clean up on imestatuswindow
Change-Id: I8bc5a73a91f28fcfd22ef716e9cf87d53997b1ad
Reviewed-on: https://gerrit.libreoffice.org/77337
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: László Németh <nemeth@numbertext.org>
2019-09-04 09:12:32 +02:00
Mike Kaganski
a06b83ff92 Parent reference should be const in VCL builder entry points
Change-Id: I2331e19f5e23e0dde8edd22befc7287515adf37e
Reviewed-on: https://gerrit.libreoffice.org/78536
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-03 12:00:40 +02:00
Noel Grandin
9c4ae2ac2b loplugin:unusedfields
Change-Id: I73e94fe2bcf6e206ae8f78380abf2a399aa6dc01
Reviewed-on: https://gerrit.libreoffice.org/78365
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-01 18:35:58 +02:00
Noel Grandin
6fb4528649 loplugin:unusedmethods
Change-Id: Ifaf3860a31fc151bb7052db1b87962b8aba27c37
Reviewed-on: https://gerrit.libreoffice.org/78366
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-01 15:35:41 +02:00
Andrea Gelmini
0940229305 Fix '..'
To complete this:
https://gerrit.libreoffice.org/#/c/78312/

This is a massive replace for lines ending with
".." instead of "..."

It passed "make check" on Linux.

Change-Id: I07fa7b2e30ba9ea17a1f9a5e21c57216ba958efe
Reviewed-on: https://gerrit.libreoffice.org/78356
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2019-09-01 11:15:11 +02:00