summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)Author
2019-09-26loplugin:unnecessaryvirtualNoel Grandin
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 Bergmann
"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ňák
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ňák
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ňák
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 Grandin
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 Grandin
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 Bergmann
...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 Bergmann
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 Bergmann
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 Bergmann
...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 Bergmann
...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 Grandin
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ňák
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ňák
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 Gelmini
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 Bergmann
...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 Grandin
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 Toth
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 Kaganski
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 Grandin
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 Grandin
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 Gelmini
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 Grandin
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 Gelmini
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 Grandin
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 Bergmann
...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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Bergmann
...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>
2019-08-23new loplugin:returnconstvalNoel Grandin
look for code that thwarts copy-elision/move optimisations by returning const values. Change-Id: Iafa038d15051e06ee76d8a1c0ce8b7d234cd8488 Reviewed-on: https://gerrit.libreoffice.org/77964 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-21llvm::make_unique is gone from LLVM trunkStephan Bergmann
(but when targeting older versions of LLVM/Clang, COMPILER_PLUGINS_CXX can still specify -std=c++11) Change-Id: I1b91f2817516d015bc12b6a3faf1874ab938a3ae Reviewed-on: https://gerrit.libreoffice.org/77866 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-21loplugin:constvars, look for loop vars that can be constNoel Grandin
Change-Id: I67ee714739800f3718f9d3facf57474cd564d855 Reviewed-on: https://gerrit.libreoffice.org/77415 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-18Revert "loplugin:unusedmethods"Noel Grandin
This reverts commit 7990680e92e4fba376ef4f9346d1bc53661bde30. screenshot build is failing Change-Id: Idfe4cac73edaf9be1e704c0bd734e858643defda Reviewed-on: https://gerrit.libreoffice.org/77654 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-17loplugin:unusedmethodsNoel Grandin
Change-Id: I781a514787c83063dadd549ee043bbb264eee060 Reviewed-on: https://gerrit.libreoffice.org/77619 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-17loplugin:unnecessaryvirtualNoel Grandin
Change-Id: I9f2e524a4fb467ddc198fce1ff4740d3768ceeac Reviewed-on: https://gerrit.libreoffice.org/77618 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-16move WizardMachine to vclCaolán McNamara
Change-Id: I55cc4a6c1ad111a22a43fd66a3cd01b5b02fb7cb Reviewed-on: https://gerrit.libreoffice.org/76902 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-08-16Adapt loplugin:nullptr to RecursiveASTVisitior::TraverseInitListExpr changeStephan Bergmann
...<https://github.com/llvm/llvm-project/commit/ 0a42fe70a566f22599e04a6f1344ca2dc5565e17> "[AST] Treat semantic form of InitListExpr as implicit code in traversals" Change-Id: Ifd17009fcc6933abf0e9178dbe47fb9c14b274b7 Reviewed-on: https://gerrit.libreoffice.org/77595 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-16new loplugin:sequenceloopNoel Grandin
look for places we should be using std::as_const on for-range loops over uno::Sequence, to avoid triggering a copy Change-Id: I7efb641bf09d37c87946f03428ee4eec90298c8a Reviewed-on: https://gerrit.libreoffice.org/77441 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-15LLVM trunk requires C++14 nowStephan Bergmann
...which caused failures like > [GEN] compilerplugins/clang/sharedvisitor/sharedvisitor.cxx > In file included from /data/sbergman/lo/core/compilerplugins/clang/badstatics.cxx:14: > In file included from /data/sbergman/lo/core/compilerplugins/clang/check.hxx:15: > In file included from /data/sbergman/llvm/inst/include/clang/AST/DeclBase.h:18: > In file included from /data/sbergman/llvm/inst/include/clang/AST/DeclarationName.h:16: > In file included from /data/sbergman/llvm/inst/include/clang/AST/Type.h:48: > /data/sbergman/llvm/inst/include/llvm/Support/TrailingObjects.h:252:24: error: no member named 'is_final' in namespace 'std' > static_assert(std::is_final<BaseTy>(), "BaseTy must be final."); > ~~~~~^ [...] However, unconditionally using -std=c++14 in generator.cxx would cause failures for builds against older Clang (and with COMPILER_PLUGINS_CXX specifying -std=c++11) on machines that have an old C++11-only system libstdc++. Those machines typically use --gcc-toolchain to use a newer non-system libstdc++ (cf. e.g. setting CC and CXX in lode's bin/linux_clang_dbgutil_64.env), so one solution could be to propagate such an option from CXX through to generator.cxx. But the easier fix appears to be to instead propagate the -std option. Change-Id: Ib081754ce8ad567305d1520e3a1ff6700fb22755 Reviewed-on: https://gerrit.libreoffice.org/77502 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-01drop newly unused EnableImageDisplay + EnableTextDisplayCaolán McNamara
Change-Id: I534c5fcfe2e8b55d0f01075b62e7168a10e805a9 Reviewed-on: https://gerrit.libreoffice.org/76819 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-08-01skip some indirectionNoel Grandin
these don't need to use std::unique_ptr Change-Id: I03140c7957fd59443db932c37890a6742c6d3bec Reviewed-on: https://gerrit.libreoffice.org/76800 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-01missing includeStephan Bergmann
Change-Id: I9c3d551d2053b53bde3b032036bc531a02217300 Reviewed-on: https://gerrit.libreoffice.org/76782 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-08-01new loplugin:mapindexNoel Grandin
Change-Id: I6b5f73b2187009e95d4d666e03e5803f522cee06 Reviewed-on: https://gerrit.libreoffice.org/76584 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-31Improved loplugin:stringconstant (now that GCC 7 supports it)Stephan Bergmann
Change-Id: I8f83c1941b8f39b261005939f4dcf3577ae9fc6f Reviewed-on: https://gerrit.libreoffice.org/76702 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-30remove newly unused SvxCheckListBoxCaolán McNamara
Change-Id: I6a5f4dfea9fbb34f02c1752140e04d1d0a8a67a7 Reviewed-on: https://gerrit.libreoffice.org/76617 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-07-30tdf#62699 Drop (now) pass-through header include/vcl/salbtype.hxxGabor Kelemen
Change-Id: I2e2093ac3c8c6833b70d4932bc12a82a4483bde5 Reviewed-on: https://gerrit.libreoffice.org/76499 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>