summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)AuthorFilesLines
2019-09-30new loplugin:duplicate-definesNoel Grandin1-0/+105
Change-Id: I98e17e0a92ae5d51778b9a72c679ed262a6f5cb0 Reviewed-on: https://gerrit.libreoffice.org/79826 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-29constmethod for accessor-type methodsNoel Grandin3-57/+56
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-28loplugin:virtualdead in basegfxNoel Grandin1-6/+0
Change-Id: I8b3f7810eb08b5217df30b7be27aafadeeed247a Reviewed-on: https://gerrit.libreoffice.org/79647 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28loplugin:virtualdead in chart2Noel Grandin1-6/+0
Change-Id: Ia24e5072cf4d16e8a437323fa7fd5ab5207e71d2 Reviewed-on: https://gerrit.libreoffice.org/79645 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28loplugin:virtualdead in dbaccessNoel Grandin1-3/+0
Change-Id: I030283816185f42f9012c8dfb2d745164abd7234 Reviewed-on: https://gerrit.libreoffice.org/79644 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28loplugin:virtualdead in basctlNoel Grandin1-3/+0
Change-Id: I6a3f74a3c52f3fb97b26de69b20ffd7502968d5e Reviewed-on: https://gerrit.libreoffice.org/79646 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28loplugin:virtualdead in editengNoel Grandin1-3/+0
Change-Id: I72f9cf62f9daeaed5108ede41dd41544204a9745 Reviewed-on: https://gerrit.libreoffice.org/79643 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-28loplugin:virtualdead in extensionsNoel Grandin1-3/+0
Change-Id: I953ceaccf6c7d0cfe1f98006a6ed00544399ef97 Reviewed-on: https://gerrit.libreoffice.org/79642 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27loplugin:virtualdead in sdNoel Grandin1-6/+0
Change-Id: Idca2a3a53c4b79ba21a3113da63a8a96d8b2cd81 Reviewed-on: https://gerrit.libreoffice.org/79641 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27loplugin:virtualdead in slideshowNoel Grandin1-3/+0
Change-Id: Ie158b76e6d552b1189173e30fbea5a43a774180b Reviewed-on: https://gerrit.libreoffice.org/79640 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27loplugin:virtualdead in svlNoel Grandin1-6/+0
Change-Id: Idbb5d0a633f12d5813561a2ad8aed46ec6d67c48 Reviewed-on: https://gerrit.libreoffice.org/79639 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-27loplugin:virtualdead in svxNoel Grandin1-9/+0
Change-Id: I8af09a2f0a4a8c7952c5855b2934f2d0a64d9740 Reviewed-on: https://gerrit.libreoffice.org/79638 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26loplugin:virtualdead filter out some more stuff Noel Grandin2-68/+2
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-26loplugin:virtualdead in vclNoel Grandin1-15/+0
Change-Id: I54cacce6d843f41f220ac5350868bd6d70dbc6b4 Reviewed-on: https://gerrit.libreoffice.org/79585 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26loplugin:virtualdead in sw(2)Noel Grandin1-3/+0
Change-Id: Ib948148fa21d595faa8a4a86d4f47243755885ee Reviewed-on: https://gerrit.libreoffice.org/79588 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26loplugin:virtualdead in swNoel Grandin1-9/+0
Change-Id: Ib96caad8a2bbfc4ff9a5191abbd49789d142d2eb Reviewed-on: https://gerrit.libreoffice.org/79587 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26new loplugin virtualdeadNoel Grandin3-0/+633
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-26loplugin:unnecessaryvirtualNoel Grandin1-17/+37
Change-Id: I866d7bd03a41260a9b4f4be87a7a02d3ceecc1c7 Reviewed-on: https://gerrit.libreoffice.org/79534 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-25Improve loplugin:sequenceloop diagnostic adviceStephan Bergmann2-2/+3
"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-24support O(U)String::number() for fast string concatenationLuboš Luňák2-0/+14
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-24compiler check for rtl::OUStringConcat instancesLuboš Luňák4-6/+175
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-20rebuild sharedvisitor.cxx if any of its sources disappearsLuboš Luňák1-0/+22
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-19improve and enable loplugin:fragiledestructorNoel Grandin2-41/+160
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-17disable stringbuffer pluginNoel Grandin1-1/+1
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-17Fix compilerplugins for macOS againStephan Bergmann1-2/+3
...in the same spirit as how COMPILER_PLUGINS_TOOLING_ARGS had been introduced with ad7e2af4ed0c11f8571374fbb40d38b38c27959c "Allow to pass additional options into generator's clang::tooling": For one, ceb26770b3d1c5c2ffaf73f8f589c5e169e6db06 "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 dc79dc76f18148296ae18ed7251cf61505e25d44 "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-13Avoid some false loplugin:redundantfcast involving std::function and lambdasStephan Bergmann3-2/+98
Change-Id: Id9a93fb60f957d75450deb93f1461b1d9dacf8ca Reviewed-on: https://gerrit.libreoffice.org/78860 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-12One more generated file missing from compilerplugins/.gitignoreStephan Bergmann1-0/+1
Change-Id: I19bfb57f842d3c4fbff011c019b637ec1b80314f Reviewed-on: https://gerrit.libreoffice.org/78826 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-11Adapt compilerplugins/.gitignoreStephan Bergmann1-0/+17
...to ceb26770b3d1c5c2ffaf73f8f589c5e169e6db06 "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-11Adapt compilerplugins.cleanStephan Bergmann1-1/+10
...to ceb26770b3d1c5c2ffaf73f8f589c5e169e6db06 "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-11loplugin:redundantfcast check for std::function castNoel Grandin2-23/+57
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-06make clangplugin analyzer use internally a PCH to speed things upLuboš Luňák3-4/+44
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-06split clangplugins sharedvisitor generator into two stepsLuboš Luňák5-2114/+473
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-06Fixing "...."Andrea Gelmini4-4/+4
Change-Id: Id005a7531d546dd43de13b49bcb3e93081c5ad8d Reviewed-on: https://gerrit.libreoffice.org/78679 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-05Use compat::IgnoreImplicitStephan Bergmann1-2/+2
...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-05loplugin:noexceptmove improve feedbackNoel Grandin1-0/+14
Change-Id: I16612abd535812bdb9d46aa9886b1e02747aab6f Reviewed-on: https://gerrit.libreoffice.org/78614 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-04tdf#118314 Code clean up on imestatuswindowSzabolcs Toth2-4/+1
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-03Parent reference should be const in VCL builder entry pointsMike Kaganski1-2/+2
Change-Id: I2331e19f5e23e0dde8edd22befc7287515adf37e Reviewed-on: https://gerrit.libreoffice.org/78536 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-01loplugin:unusedfieldsNoel Grandin4-234/+246
Change-Id: I73e94fe2bcf6e206ae8f78380abf2a399aa6dc01 Reviewed-on: https://gerrit.libreoffice.org/78365 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-01loplugin:unusedmethodsNoel Grandin2-79/+43
Change-Id: Ifaf3860a31fc151bb7052db1b87962b8aba27c37 Reviewed-on: https://gerrit.libreoffice.org/78366 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-01Fix '..'Andrea Gelmini1-1/+1
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-08-30adapt to runToolOnCodeWithArgs API change in clang 10Noel Grandin2-2/+8
which required including config_host in generator, which in turn required adapting the makefile Change-Id: Icafa3b59816f52c349fbbd76ce71305856c9ce33 Reviewed-on: https://gerrit.libreoffice.org/78293 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-30Fix typosAndrea Gelmini1-2/+2
Change-Id: I965ade27bdbd5d1f0e6cc902c1f01fa905e668f2 Reviewed-on: https://gerrit.libreoffice.org/78305 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-08-30new loplugin:noexceptmoveNoel Grandin2-0/+421
idea from mike kaganski look for places where we can mark move operators as noexcept, which makes some STL operations more efficient Change-Id: Id732b89d1fcadd5ceb0ea2b9d159fed06136330f Reviewed-on: https://gerrit.libreoffice.org/78251 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-28New loplugin:stdfunctionStephan Bergmann4-13/+141
...finding dubious additions to namespace std (concentrating on functions for now). C++17 [namespace.std]/1: "The behavior of a C ++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified." This found ad4c7b97752b4da73808402604d6f96b39d920f5 "Avoid declaring function templates in namespace std" 042e30a3dc057aef4a02d95960e4dd4fb8d083ae "Avoid adding a function template declaration to namespace std" cae9240a76cdb0eeed92421930d3b4cbef0ac201 "Avoid adding a function declaration to namespace std" Change-Id: Ic2ba54e2a8bf931d5c58cedf499c0d1229eb2166 Reviewed-on: https://gerrit.libreoffice.org/78220 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-27loplugin:referencecasting find more redundant static_castNoel Grandin5-41/+125
Change-Id: I3a51812bbd3fcdc6b11e47cb12962f0d4fa7a2ae Reviewed-on: https://gerrit.libreoffice.org/78191 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-26loplugin:unusedmethodsNoel Grandin2-140/+256
Change-Id: I9d1abe62e7e0ae3434e0b2d440d6ccf0435e97cc Reviewed-on: https://gerrit.libreoffice.org/78131 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-26loplugin:unusedenumconstantsNoel Grandin3-2202/+2250
Change-Id: I4c75db3931e234d04a8d14f0a9dc9103132b0e72 Reviewed-on: https://gerrit.libreoffice.org/78137 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-26use shared-plugin infra for some recent pluginsNoel Grandin6-17/+136
Change-Id: Ia9cba59718de91fed2045ffd7e0ec06d28bf37dc Reviewed-on: https://gerrit.libreoffice.org/78118 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-26loplugin:returnconstval in variousNoel Grandin1-1/+1
Change-Id: Ib5d293417b1faeb7ef63a8df99fc1ba644989cdc Reviewed-on: https://gerrit.libreoffice.org/78079 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-23Improve loplugin:sequenceloop warningStephan Bergmann1-1/+1
...from > sfx2/source/appl/shutdowniconaqua.mm:416:13: error: use std::as_const, or make range var const, to avoid creating a copy of the Sequence [loplugin:sequenceloop] > for ( auto const & newMenuProp : aNewMenu ) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ to > sfx2/source/appl/shutdowniconaqua.mm:416:46: error: use std::as_const, or make range var const, to avoid creating a copy of the Sequence [loplugin:sequenceloop] > for ( auto const & newMenuProp : aNewMenu ) > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ Change-Id: I1eabe80abeed1784a246a6e3c9b7036f664ee681 Reviewed-on: https://gerrit.libreoffice.org/77989 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>