summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)AuthorFilesLines
2018-10-17new loplugin staticvarNoel Grandin2-0/+284
looks for variables that can be declared const and static i.e. they can be stored in the read-only linker segment and shared between different processes Change-Id: I577fb2070604003e56fb44f8a02c9684070311cf Reviewed-on: https://gerrit.libreoffice.org/61817 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-17loplugin:singlevalfieldsNoel Grandin3-46/+326
tighten up the handling of binary operators Change-Id: I262ec57bf7142fa094d240738150a94d83fd15ee Reviewed-on: https://gerrit.libreoffice.org/61777 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15loplugin:staticconstfield improvementsNoel Grandin2-83/+154
And fix ScXMLCachedRowAttrAccess::Cache which was never setting its mnTab field, and hence would never be hit. And fix oox::xls::CellBlockBuffer, which was never setting mnCurrRow. Change-Id: I2c46aa050b9ebe3c2dc2e52579555f97945dd61c Reviewed-on: https://gerrit.libreoffice.org/61772 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15Relicense LoopVarTooSmall plugin to use LLVM licenseTamás Zolnai2-8/+12
Change-Id: I9e8cf6d7c2474f8c4c624dd9040890997c43f788 Reviewed-on: https://gerrit.libreoffice.org/61789 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-10-15Add the already referenced LICENSE.TXT with the LLVM licenseTamás Zolnai1-0/+40
From: https://opensource.org/licenses/UoI-NCSA.php Change-Id: I81dc98ec532e3cd6787abc491d81346fae87c087 Reviewed-on: https://gerrit.libreoffice.org/61793 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-10-15loplugin:constantparamNoel Grandin4-792/+781
Change-Id: I895ceffa468d84d22e4a81b7a6b06eaed0bd839d Reviewed-on: https://gerrit.libreoffice.org/61776 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15loplugin:unusedfieldsNoel Grandin4-71/+85
Change-Id: I4ebd1e89daf7ba5e6ab709f56c0fec5b49f50dd0 Reviewed-on: https://gerrit.libreoffice.org/61774 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15loplugin:unusedmethodsNoel Grandin2-73/+63
Change-Id: I0226d33cbe224519cf2ed9ea5143ffe68fdbc884 Reviewed-on: https://gerrit.libreoffice.org/61775 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-15loplugin:constfields in ooxNoel Grandin1-0/+2
Change-Id: I1e110d193ebfa30ab1ab0d85bfb6dc409e341439 Reviewed-on: https://gerrit.libreoffice.org/61728 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-12loplugin:constfields in reportdesign,sal,saxNoel Grandin1-3/+30
and improve the rewriter so I spend less time fixing formatting Change-Id: Ic2a6e5e31a5a202d2d02a47d77c484a57a5ec514 Reviewed-on: https://gerrit.libreoffice.org/61676 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-10Fix failure of loplugin:useuniqueptr with older compilersStephan Bergmann3-4/+45
...where CompilerTest_compilerplugins_clang failed in compilerplugins/clang/test/useuniqueptr.cxx due to Foo24's HTMLAttrs::const_iterator it = m_aSetAttrTab.begin(); and either the old compiler lacked Clang's recent <https://reviews.llvm.org/D50666> "Fix Stmt::ignoreImplicit" (and the above initialization expression happens to include a CXXBindTemporaryExpr, at least with libstdc++), or an even older compiler was used in pre-C++17 mode, so the above initialization expression happens to include an elidable CXXConstructExpr copy constructor call. Change-Id: I757a9ad76829e399b4fe2da1c82863909b8c9657 Reviewed-on: https://gerrit.libreoffice.org/61531 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-09Extend loplugin:redundantinline to catch inline functions w/o external linkageStephan Bergmann3-38/+100
...where "inline" (in its meaning of "this function can be defined in multiple translation units") thus doesn't make much sense. (As discussed in compilerplugins/clang/redundantinline.cxx, exempt such "static inline" functions in include files for now.) All the rewriting has been done automatically by the plugin, except for one instance in sw/source/ui/frmdlg/column.cxx that used to involve an #if), plus some subsequent solenv/clang-format/reformat-formatted-files. Change-Id: Ib8b996b651aeafc03bbdc8890faa05ed50517224 Reviewed-on: https://gerrit.libreoffice.org/61573 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-09loplugin:unusedmethodsNoel Grandin2-67/+87
Change-Id: Icd7a0f9909f36363b307b4fe7ee920183881afbb Reviewed-on: https://gerrit.libreoffice.org/61576 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-09loplugin:unusedfieldsNoel Grandin4-114/+112
Change-Id: Iacce8e12a85f857192dc0520b795e1990a3612db Reviewed-on: https://gerrit.libreoffice.org/61575 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-08Fix loplugin:useuniqueptr for libc++ (macOS)Stephan Bergmann1-1/+4
...after 05a337e297eb0cfe88c99503d760bd9eaf495b7d "loplugin:useuniqueptr look for deleting in loops with iterators", where it didn't emit the warning for Foo24 in compilerplugins/clang/test/useuniqueptr.cxx during CompilerTest_compilerplugins_clang, because in the initialization of HTMLAttrs::const_iterator it = m_aSetAttrTab.begin(); the HTMLAttrs::const_iterator CXXConstructExpr happens to have a second, defaulted argument. Change-Id: I882a6dfb5cab1b147f790072f2545b13172c0f9a Reviewed-on: https://gerrit.libreoffice.org/61530 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-08compilerplugins: the useuniqueptr clang plugin test fails on 5.0.1Miklos Vajna1-1/+1
I'm not sure what is the first version that passes it, let's go with 6.0 for now. Change-Id: I7a150fbc2a722a6a47d91de4b00893303add5cc8
2018-10-06Fix typoAndrea Gelmini1-1/+1
Change-Id: I822fa325d37955583a21e4d7ce2e79a4d5b02fc5 Reviewed-on: https://gerrit.libreoffice.org/61462 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-10-05loplugin:useuniqueptr look for deleting in loops with iteratorsNoel Grandin2-180/+366
Change-Id: I0e5bf671ee11265c0afa8770430ec9e064e05fe3 Reviewed-on: https://gerrit.libreoffice.org/61402 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-03loplugin:unusedmethodsNoel Grandin1-51/+17
Change-Id: I9e583df920657ab401162db79decb192c4f69f90 Reviewed-on: https://gerrit.libreoffice.org/61283 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-03loplugin:constfields in swNoel Grandin1-7/+14
Change-Id: I1eb6583bb9ec815bc0564b0d7c676f5b1fb9045f Reviewed-on: https://gerrit.libreoffice.org/61177 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-03loplugin:unusedfieldsNoel Grandin4-5/+9
Change-Id: I3d2cdd80b542dbdbd29971ef837111191809f081 Reviewed-on: https://gerrit.libreoffice.org/61282 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-03loplugin:unusedmethodsNoel Grandin2-78/+82
Change-Id: I7db0c27ff2213210ed4b46ebbadc1a2f74a18257 Reviewed-on: https://gerrit.libreoffice.org/61249 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-03loplugin:unusedfieldsNoel Grandin4-70/+48
Change-Id: Idf6f7f2946eecada64d2a586194533840ec8cc63 Reviewed-on: https://gerrit.libreoffice.org/61248 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-01Add loplugin:includeform documentationStephan Bergmann1-0/+2
Change-Id: I5a8c6ab0a967d9da2e1764301cd54f87f467a653 Reviewed-on: https://gerrit.libreoffice.org/61176 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-10-01implicitboolconversion: ignore quint64 bitfieldJan-Marek Glogowski1-2/+8
Change-Id: I97380455b9f526b75c7d3855d188d2f659035ba2 Reviewed-on: https://gerrit.libreoffice.org/61170 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-28loplugin:unusedmethodsNoel Grandin2-37/+59
Change-Id: I5f9ef043d76c55f2c761fd08a2bc1dae66b675c8 Reviewed-on: https://gerrit.libreoffice.org/61073 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-28Fix typoAndrea Gelmini1-1/+1
Change-Id: I3473cb5a565aba822428178030572325425c6a13 Reviewed-on: https://gerrit.libreoffice.org/61030 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-09-28loplugin:unusedfieldsNoel Grandin4-157/+219
Change-Id: I355fad84ed8765e8eb3fadb7c239b3b902ec1747 Reviewed-on: https://gerrit.libreoffice.org/61059 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-28Fix E_SUCCEDED -> E_SUCCEEDEDAndrea Gelmini1-1/+1
It passed "make check" on Linux. Change-Id: I96b34c818f6d4170c110ecd1fb93af79c3279e57 Reviewed-on: https://gerrit.libreoffice.org/61028 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-09-27loplugin:methodcycles more graph theory for the winNoel Grandin3-77/+177
implemeent a reduction approach, which is good at finding virtual methods that only themselves or their virtual partners. The accessibility GetVisArea stuff is dead since commit 891e41fac81fbd8d5cdb277b26639abfd25a7143 Date: Wed Apr 4 11:23:22 2018 +0200 dead code in AccessibleTextHelper_Impl::UpdateVisibleChildren Change-Id: I78d9d8bca585ecec8394f2c3fe2baa93db0e58f5 Reviewed-on: https://gerrit.libreoffice.org/60912 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-24loplugin:external (clang-cl)Stephan Bergmann1-10/+36
Including: * expanding STDAPI to its definition (as per <https://msdn.microsoft.com/library/ms686631(vs.85).aspx> "STDAPI"), to add __declspec(dllexport) into its middle, in extensions/source/activex/so_activex.cxx; as discussed in the comments at <https://gerrit.libreoffice.org/#/c/60691/> "Get rid of Windows .def files in setup_native, use __declspec(dllexport)", having a function both listed in a .def file EXPORTS and marking it dllexport is OK, and the latter helps the heuristics of loplugin:external; however, the relevant functions in extensions/source/activex/so_activex.cxx probably don't even need to be exported in the first place? * follow-up loplugin:salcall in sal/osl/w32/file-impl.hxx Change-Id: Ida6e17eba19cfa3d7e5c72dda57409005c0a0191 Reviewed-on: https://gerrit.libreoffice.org/60938 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-23loplugin:unusedmethodsNoel Grandin2-152/+154
Change-Id: I9dac9260af9955dc4a66b34c33265c6e36094322 Reviewed-on: https://gerrit.libreoffice.org/60911 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-22Always disable loplugin:expressionalwayszero, to avoid false positivesStephan Bergmann1-5/+0
bdade7e3fc33c1832c6f6a472443fca8238738d2 "tdf#105444 DOCX import: don't put extra paragraphs in comments" caused > /home/sbergman/lo2/core/writerfilter/source/dmapper/DomainMapper_Impl.cxx:441:22: error: expression always evaluates to zero, lhs=0 rhs=unknown [loplugin:expressionalwayszero] > (sizeof(SAL_NEWLINE_STRING)-1 == 2 && xCursor->getString() == "\n")) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ now with sufficiently new Clang, and the code looks reasonable, and there's no apparent way to avoid such false positives in the plugin. (It could check for a sub-expression of the problematic expression being an object-like macro, but SAL_NEWLINE_STRING could just as well be a variable instead of a macro. That variable would need to be defined in some #if to have different values on different platforms, so the plugin could theoretically check for such conditional inclusion, but it's not clear whether that's worth it and would even be a useful heuristic to not produce neither too many false positives nor too many false negatives.) So just disable the plugin for good. Change-Id: I85dc8573735ccac4e19be20ab7443cbaa85a3164 Reviewed-on: https://gerrit.libreoffice.org/60907 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-21new loplugin:methodcyclesNoel Grandin4-4/+698
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-20Replace SAL_FINAL with final in internal codeStephan Bergmann1-1/+1
Change-Id: Ib0d3324d7021ba1a8ff9779807d0a900be5e6226 Reviewed-on: https://gerrit.libreoffice.org/60802 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-18loplugin:unusedmethodsNoel Grandin2-50/+80
Change-Id: I5f63ac44654ed3fc658e72e0d1148a5a22decc47 Reviewed-on: https://gerrit.libreoffice.org/60662 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-18loplugin:unusedfields improve search for unused collection fieldsNoel Grandin2-18/+104
look for collection-like fields that are never added to, and are therefore effectively unused Change-Id: Id52c5500ea5e3d2436fb5915aebb86278bf2d925 Reviewed-on: https://gerrit.libreoffice.org/60661 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-18loplugin:useuniqueptr check more local variablesNoel Grandin2-93/+334
Change-Id: I8387731747ee6eb7d74037c0eff7fc9ac0b884c8 Reviewed-on: https://gerrit.libreoffice.org/60619 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17loplugin:staticconstfield improvementsNoel Grandin2-13/+124
Change-Id: Ia0a19736dfd4500bb17b04c072710f8ee8744031 Reviewed-on: https://gerrit.libreoffice.org/60526 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-17New loplugin:externalStephan Bergmann1-0/+323
...warning about (for now only) functions and variables with external linkage that likely don't need it. The problems with moving entities into unnamed namespacs and breaking ADL (as alluded to in comments in compilerplugins/clang/external.cxx) are illustrated by the fact that while struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } returns 1, both moving just the struct S2 into an nunnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { namespace { struct S2: S1 { int f() { return 1; } }; } int f(S2 s) { return s.f(); } } int main() { return f(N::S2()); } as well as moving just the function f overload into an unnamed namespace, struct S1 { int f() { return 0; } }; int f(S1 s) { return s.f(); } namespace N { struct S2: S1 { int f() { return 1; } }; namespace { int f(S2 s) { return s.f(); } } } int main() { return f(N::S2()); } would each change the program to return 0 instead. Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c Reviewed-on: https://gerrit.libreoffice.org/60539 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-16rename conststringfield loplugin to staticconstfieldNoel Grandin2-9/+9
in preparation for making it more general Change-Id: I2fc8d0f99140dc7ef72341f8cbf28d6536ebd61f Reviewed-on: https://gerrit.libreoffice.org/60525 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-14Check that loplugin:unreffun warns for explicitly "extern" functionsStephan Bergmann2-0/+16
Change-Id: Ic43f007af4480b358916c2b27796a9b248ea9eb7 Reviewed-on: https://gerrit.libreoffice.org/60496 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-14Improve loplugin:simplifyconstruct warningsStephan Bergmann2-4/+5
Change-Id: I0a64d0eb9938d5a99416dbe4078ba4c05e5d588b Reviewed-on: https://gerrit.libreoffice.org/60465 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-13loplugin:simplifyconstruct exclude std::unique_ptr with custom deleterNoel Grandin2-3/+20
Change-Id: I8f4ba883747a2aace88786ef807fd7c338bef5da
2018-09-13new loplugin simplifyconstructNoel Grandin2-0/+98
no need to init smart pointers with nullptr, they all have default constructors that do this already Change-Id: Ief20c060daa0def8c1aa82f1cf8dc4bc696761e9 Reviewed-on: https://gerrit.libreoffice.org/59818 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-13new loplugin:constfieldsNoel Grandin6-60/+876
look for fields which are only assigned to in the constructor, so they can be made const Change-Id: I0b76817c2181227b04f6a29d6a808f5e31999765 Reviewed-on: https://gerrit.libreoffice.org/60393 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-12loplugin:unusedmethodsNoel Grandin2-82/+12
Change-Id: I0f96c41ab61bd4bfaf6c36d78d0a2ca768da0032 Reviewed-on: https://gerrit.libreoffice.org/60314 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-11loplugin:unusedfieldsNoel Grandin4-12/+40
Change-Id: Ic7871f3a40668ba73aa0f0067a45455920d55890 Reviewed-on: https://gerrit.libreoffice.org/60313 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-11loplugin:unusedmethodsNoel Grandin2-238/+188
Change-Id: I34009aabf0befb346470b5c0d96ad8fc476b7c4e Reviewed-on: https://gerrit.libreoffice.org/60300 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-09-11loplugin:unusedfieldsNoel Grandin4-122/+102
Change-Id: I876183559a7d9f1e6d914fbf37d7ffe91459144e Reviewed-on: https://gerrit.libreoffice.org/60278 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>