summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)Author
2019-10-09loplugin:redundantpointerops check other pointer typesNoel Grandin
as well as unique_ptr Change-Id: I54842bca161ee460fb96c46ca31b6f9c0a7dbbdf Reviewed-on: https://gerrit.libreoffice.org/80455 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-08My Windows clang-cl build still doesn't use LO_CLANG_SHARED_PLUGINSStephan Bergmann
...so disable the new configure.ac checks introduced with ad5cbcf6ba0afdc1d8d7405c2641cce8de4a360b "try to autodetect flags needed to build Clang plugins" that are only relevant when using LO_CLANG_SHARED_PLUGINS and would fail miserably for my clang-cl build Change-Id: I58f7f1f4608f1a615175f0c0d0d98c03c442a36c Reviewed-on: https://gerrit.libreoffice.org/80477 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-08better name for a function in compilerpluginsLuboš Luňák
The function is not just about a spelling location. Change-Id: I96e9e9ef7e27a9763397b4b86473c1c30d0e3eeb Reviewed-on: https://gerrit.libreoffice.org/80381 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-08New loplugin:classmemaccessStephan Bergmann
...to complement and improve upon GCC's -Wclass-memaccess. See the comment at the head of compilerplugins/clang/classmemaccess.cxx for details. (It is not yet clear to me whether we would want to get this upstreamed into Clang.) 35d21e4bf6f66b3bbc7a44fcf184cb721b524a94 "Remove redundant memsets" was a case that benefited from looking through toplevel casts to void*. (Though the code in include/basic/sbxvar.hxx needs a slightly more verbose way to deliberately silence the warning now.) d03041e19215592f21ba1222d3cfa29e1f94260a "Drop bogus memsets" is one example of various cases that GCC -Wclass-memaccess failed to catch due to the use of array instead of pointer types. Change-Id: I6a9bfc34e3536834af35fdf4fb7ceeb31f31f8c0 Reviewed-on: https://gerrit.libreoffice.org/80421 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-08More generated files to take care ofStephan Bergmann
Change-Id: I4a150389e42959bb8e522dbf488eda24ac934f00 Reviewed-on: https://gerrit.libreoffice.org/80422 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-08loplugin:redundantpointerops simplify *p.get()Noel Grandin
Change-Id: I12517651fb3f777fd08e384992bb3e84b340ad85 Reviewed-on: https://gerrit.libreoffice.org/80382 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-07try to autodetect flags needed to build Clang pluginsLuboš Luňák
Instead of having a lot of it hardcoded, which brings problems like: - Clang-to-be-10 has switched to -std=c++14, so our hardcoded c++11 makes the build fail - I cannot compile with my openSUSE-shipped clang, because it ships only libclang-cpp and not the other libClangSomething libs The possibility to explicitly set the necessary variables is still there. Change-Id: I58d401d4584fa064f1c1351a8a06ff4e29643063 Reviewed-on: https://gerrit.libreoffice.org/80300 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-07fix various warnings in compilerpluginsLuboš Luňák
These are triggered when using llvm-config --cxxflags for building, and sometimes there's -Werror. The warnings were mostly unused variables because of being used only in assert(), or default case in switch that covers all enums (it's better to not handle default to get warning if a case is not handled). Change-Id: I0ecdd1f27390aadf033852b0d1ee0ca424ae3c37 Reviewed-on: https://gerrit.libreoffice.org/80317 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-07generate make dependencies also for clang.pchLuboš Luňák
Change-Id: Id05f2741763ef0d9e87d9804339d29aee6bc068f Reviewed-on: https://gerrit.libreoffice.org/80380 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-07Fix function name, "revert" -> "reverse"Stephan Bergmann
(See the discussion in the comments to <https://gerrit.libreoffice.org/#/c/80317/> "fix various warnings in compilerplugins".) Change-Id: Ia6ba32206ddf44bba9bb5acdd929c0750c48cca9 Reviewed-on: https://gerrit.libreoffice.org/80372 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-07do not use compiler.getSourceManager().getFilename()Luboš Luňák
This is a continuation of ff002524c12471668e63837a804b6006f9136a34. When compiling with icecream, its -frewrite-includes merges all #include's into one .cxx file and marks them with with line markers. But SourceManager::getFilename() doesn't take those into account and so it reports all of those as <stdin>. So use getFileNameOfSpellingLoc(), which explicitly handles this case. And we should probably never ever use SourceManager::getFilename(). Change-Id: Ia194c2e041578e1e199aee2df2f885922ef7e31a Reviewed-on: https://gerrit.libreoffice.org/80326 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-06the PCH in compilerplugins should also depend on the MakefileLuboš Luňák
Otherwise it may not get rebuilt in Jenkins when flags in the Makefile change. Change-Id: I9a06c5bbfd4af2714497c5658d8c523a6c929f68 Reviewed-on: https://gerrit.libreoffice.org/80318 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-06replace throw with abortLuboš Luňák
There is nothing catching the exception anyway, and this fails to compile if compiling the plugin with Clang's CXXFLAGS (which include -fno-exceptions). Change-Id: Iad9316ad9613e4fd66d0e5a16fd71bbb8066cc2b Reviewed-on: https://gerrit.libreoffice.org/80299 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-10-04loplugin:unusedfieldsNoel Grandin
Change-Id: If0df5216dccd2c0a7aa790668471993f5d4d5d32 Reviewed-on: https://gerrit.libreoffice.org/80183 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-04loplugin:unusedmethodsNoel Grandin
Change-Id: Idd98dc9e1090a6b09124c80eed5a878e5e966cfc Reviewed-on: https://gerrit.libreoffice.org/80182 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-04loplugin:methodcyclesNoel Grandin
Change-Id: Ie2eeba83bf176d5c2beadc4dc5286e827ddbadfc Reviewed-on: https://gerrit.libreoffice.org/80155 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-04loplugin:singlevalfieldsNoel Grandin
Change-Id: Ic74b400f0b929b4c57ad70d0b0936983a3d46360 Reviewed-on: https://gerrit.libreoffice.org/80154 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03loplugin:unnecessaryvirtualNoel Grandin
Change-Id: Ib329e251ee405f60568a2fea6cb93f54a84063cd Reviewed-on: https://gerrit.libreoffice.org/80144 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03loplugin:virtualdeadNoel Grandin
Change-Id: I86bae18ed2682871032aeb2a178f49f3e4601129 Reviewed-on: https://gerrit.libreoffice.org/80129 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03loplugin:unusedmethodsNoel Grandin
Change-Id: I9790d053248ae6bd58ecc026c774014c4e5e04aa Reviewed-on: https://gerrit.libreoffice.org/80115 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-03loplugin:unusedfieldsNoel Grandin
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-02new loplugin:stringaddNoel Grandin
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-Werror,-Winconsistent-missing-overrideStephan Bergmann
Change-Id: I4cfb01582e5cfef55909ae56fd14ce8ccd5c14be Reviewed-on: https://gerrit.libreoffice.org/79990 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01loplugin:noexceptmove: Cater for null FunctionDecl::getBodyStephan Bergmann
...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-01Silence a supposedly unproblematic loplugin:badstatics (clang-cl)Stephan Bergmann
Change-Id: I9c76fb4aca21757a0bf033103bd6dc2bea740eb5 Reviewed-on: https://gerrit.libreoffice.org/79932 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01Remove spurious #include <unistd.h>Stephan Bergmann
(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-01Use loplugin::isSamePathname (as needed on Windows)Stephan Bergmann
Change-Id: I8a1df1c64a93dc3e4a6fb00afd11aaf8521ecea4 Reviewed-on: https://gerrit.libreoffice.org/79926 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-30new loplugin:duplicate-definesNoel Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 Grandin
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 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>