summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)AuthorFilesLines
2018-01-25loplugin:datamembershadow in PresenterPaneNoel Grandin1-2/+0
the subclass field is just a copy of the parent field, so drop the subclass, and consequently simply the CreateCanvases method, we don't need to pass the parameter down, can just access the parent field. Change-Id: I3be448a06b32d01cdda4fc36b78cafb4488e2913 Reviewed-on: https://gerrit.libreoffice.org/48553 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-25loplugin:datamembershadow in SvxUnoTextRangeBaseNoel Grandin1-4/+1
make the superclass member private Change-Id: I665d87bfdfc3d7804cd4cac6108f9bc65b9ca2b5 Reviewed-on: https://gerrit.libreoffice.org/48552 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-25loplugin:datamembershadow in SdXMLShapeLinkContextNoel Grandin1-2/+0
in this case, we can just drop the child member and re-use the parent member. The parent class barely contains any logic anyway. Change-Id: I520217c04a38b66323a76bf5fddb476bd3fc8e15 Reviewed-on: https://gerrit.libreoffice.org/48551 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-24loplugin:constparamsNoel Grandin1-0/+2
Change-Id: I7c695073d9a9d3b7a641d6eb9fe01a47d8c3a504 Reviewed-on: https://gerrit.libreoffice.org/48392 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-23Remove unused TypeCheck::SubstTemplateTypeParmTypeStephan Bergmann2-11/+0
...introduced unused with 91b4e4531621b7afb2dbab1a8aa62c92da66951a "new loplugin: pointerbool" Change-Id: I3af0ce878f1f2742223d66bcdade4e9c144162cd Reviewed-on: https://gerrit.libreoffice.org/48387 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-23new loplugin: pointerboolNoel Grandin4-0/+167
look for possibly bogus implicit conversions to bool when passing (normally pointer) args to bool params. this plugin comes in the wake of a couple of bugs caused by refactoring, where some of the call sites were not currently updated. Of the changes, the following are real bugs: desktop/../dp_persmap.cxx StartInputFieldDlg in sw/../fldmgr.cxx which occurred as a result of commit 39d719a80d8c87856c84e3ecd569d45fa6f8a30e Date: Tue May 3 11:39:37 2016 +0200 tdf#99529 sw: don't pop up input field dialog before inserting field CSerializationURLEncoded::encode_and_append in forms/../serialization_urlencoded.cxx XclExpCFImpl::XclExpCFImpl in sc/../xecontent.cxx I have no idea how to properly fix this, just made a guess. SwDocTest::test64kPageDescs in sw/qa/core/uwriter.cxx which looks like a simple copy/paste error. Change-Id: I795ebd5ef485a1d36863dc27fe13832989f5a441 Reviewed-on: https://gerrit.libreoffice.org/48291 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-20loplugin:unusedmethodsNoel Grandin2-118/+604
Change-Id: If00b0e659e1818c29ae39b89f8b4f7ea29d14986 Reviewed-on: https://gerrit.libreoffice.org/48185 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19-Werror,-Wunused-variableStephan Bergmann1-7/+1
Change-Id: I1bcfe0dabd61a2157bc4a48ea54413882ecaaabc
2018-01-19loplugin:unusedmethods also check for functions returning boolNoel Grandin1-3/+0
we were previously excluding them Change-Id: I48a68799b0de60b4995fae541eb363e043d4dd11 Reviewed-on: https://gerrit.libreoffice.org/48167 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-19new loplugin:emptyifNoel Grandin2-0/+156
Change-Id: I1092115a0ceb3a5e6680a4b724b129f98a892c42 Reviewed-on: https://gerrit.libreoffice.org/48128 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-17loplugin:unnecessaryparen extend to delete statementsNoel Grandin2-0/+26
Change-Id: Ic4383ea948876a26f791f0e5b0110cef978a26e1 Reviewed-on: https://gerrit.libreoffice.org/48027 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-17loplugin:useuniqueptr in PPDParserNoel Grandin1-0/+3
Change-Id: Iafd63c276d430ea2a08286921f593bc56587e71c
2018-01-17loplugin:useuniqueptr expand search for ranged-loop-deleteNoel Grandin2-1/+16
Change-Id: I78955f4db9b4da2858dfb25e69a5502eb0280418
2018-01-16Fix typosAndrea Gelmini2-3/+3
Change-Id: I46873c8bea3bbfeebb7dee50918d3978408fcf63 Reviewed-on: https://gerrit.libreoffice.org/47842 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2018-01-15More loplugin:cstylecastStephan Bergmann1-6/+8
...also warn about the remaining cases of C-style casts (other than idiomatic cast to void) Change-Id: I274be61ad038fc41ac470fc07ea703a0f071f456
2018-01-15loplugin:useuniqueptr in CursorNoel Grandin2-0/+17
Change-Id: I5de300709409311b7a1d451ee1d314596cf2e879 Reviewed-on: https://gerrit.libreoffice.org/47836 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-12Enable loplugin:cstylecast for some more casesStephan Bergmann3-13/+594
...mostly of C-style casts among arithmetic types, and automatically rewrite those into either static_cast or a functional cast (which should have identical semantics, but where the latter probably looks better for simple cases like casting a literal to a specific type, as in "sal_Int32(0)" vs. "static_cast<sal_Int32>(0)"). The main benefit of reducing the amount of C-style casts across the code base further is so that other plugins (that have not been taught about the complex semantics of C-style cast) can pick those up (cf. the various recent "loplugin:redundantcast" commits, which address those findings after this improved loplugin:cstylecast has been run). Also, I found some places where a C-style cast has probably been applied only to the first part of a larger expression in error (because it's easy to forget parentheses in cases like "(sal_uInt16)VOPT_CLIPMARKS+1"); I'll follow up on those individually. The improved loplugin:cstylecast is careful to output either "(performs: static_cast)" or "(performs: functional cast)", so that compilerplugins/clang/test/cstylecast.cxx can check that the plugin would automatically rewrite to one or the other form. To allow fully-automatic rewriting, this also required loplugin:unnecessaryparen to become a rewriting plugin, at least for the parens-around-cast case (where "((foo)bar)" first gets rewritten to "(static_cast<foo>(bar))", then to "static_cast<foo>(bar)". Rewriting could probably be added to other cases of loplugin:unnecessaryparen in the future, too. (The final version of this patch would even have been able to cope with 361dd2576a09fbda83f3ce9a26ecb590c38f74e3 "Replace some C-style casts in ugly macros with static_cast", so that manual change would not have been necessary after all.) Change-Id: Icd7e319cc38eb58262fcbf7643d177ac9ea0220a Reviewed-on: https://gerrit.libreoffice.org/47798 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-12teach useuniqueptr loplugin about "if(field != null) delete field"Noel Grandin2-56/+120
Change-Id: I938deef90c8d6ceb0e72ab3f6ee2cbddc6f72b8d Reviewed-on: https://gerrit.libreoffice.org/47730 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-11loplugin:useuniqueptr in tools,stoc,unotoolsNoel Grandin1-0/+5
Change-Id: Ia72b65577143623cedc7a40bc34f7fb897add097 Reviewed-on: https://gerrit.libreoffice.org/47726 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-11loplugin:useuniqueptr in l10ntoolsNoel Grandin2-248/+179
update plugin to find all places where we are unconditionally deleting stuff in a destructor Change-Id: Ia0fedc2420c7717ed2bdd8d3bb00262d2a63e0bc Reviewed-on: https://gerrit.libreoffice.org/47724 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-09Don't use non-Windows sys/time.hStephan Bergmann1-4/+4
(The comment what the test wants to check quotes noelgrandin on #libreoffice- dev.) Change-Id: I8e8980902c8113eb75d24064e68a47e70bc483d6 Reviewed-on: https://gerrit.libreoffice.org/47676 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-09Don't build off-by-default loplugin:unusedfields on Windows for nowStephan Bergmann1-0/+4
...due to missing sys/file.h Change-Id: I7cfd64c5355d9fdbb85320f876c277a408be9352 Reviewed-on: https://gerrit.libreoffice.org/47675 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-01-04sw: move some globals in fetab.cxx into SwFEShellMichael Stahl1-4/+0
It looks like the main point of these being globals is so that they can be cleared from various places when tables or table frames are destroyed. Add a SwDoc parameter to ClearFEShellTabCols() and just iterate over all shells. Change-Id: I75ad6b695ee1bfa76b9a05c606b07a3574c70ac4
2018-01-04loplugin:unusedfieldsNoel Grandin4-51/+114
fix the ReturnStmt check Change-Id: I95076076bd1313d23798c4615ea12910c86ed9a8 Reviewed-on: https://gerrit.libreoffice.org/47309 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-03loplugin:singlevalfields improve copy constructor checkNoel Grandin2-12/+27
Change-Id: Id1e7fbecd9e9f816553d2e678c3f1b7890fc4db8 Reviewed-on: https://gerrit.libreoffice.org/47293 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-03loplugin:passstuffbyref more return improvementsNoel Grandin2-6/+7
slightly less restrictive check when calling functions Change-Id: I35e268ac611797b1daa83777cda02288a635aa32 Reviewed-on: https://gerrit.libreoffice.org/47259 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-02loplugin:passstuffbyref improved return in sd,variousNoel Grandin2-0/+5
Change-Id: I4b6ea89ae2072f4389a696ea3c96d8f7a5731e7a Reviewed-on: https://gerrit.libreoffice.org/47246 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-02loplugin:passstuffbyref improved return in swNoel Grandin1-1/+2
Change-Id: I4484ac461761e4c46364b4f473c7e62f8ec72103 Reviewed-on: https://gerrit.libreoffice.org/47243 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-31loplugin:passstuffbyref improved return in emfio,writerfilterNoel Grandin1-1/+5
Change-Id: I237936d62d0f1b17574dd88b5c9de932dc03238e Reviewed-on: https://gerrit.libreoffice.org/47214 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-30Disable loplugin:casttovoid when --disable-assert-always-abortStephan Bergmann2-0/+4
...as finding uses of variables in arguments to expand-to-nothing assert macros is just not implemented not implemented. Change-Id: Iacb3bd25d03eca13ac8ff3942f98e46dee3286b9 Reviewed-on: https://gerrit.libreoffice.org/47200 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-29loplugin:unnecessaryoverride fix for changing accessNoel Grandin2-1/+19
Change-Id: I61b908999be7d94eed0c421125f8e1fc07e3c2db Reviewed-on: https://gerrit.libreoffice.org/47182 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-29loplugin:unnecessaryparen improve return checkNoel Grandin1-20/+26
Change-Id: I8128aa4b5fc60efd1dbf5971cdde11e588f5f64b Reviewed-on: https://gerrit.libreoffice.org/47167 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-27loplugin:passstuffbyref improved return in xmloff,sfx2Noel Grandin1-1/+2
Change-Id: I7161dfca77f944027bd20614616e22d6acfa27cd Reviewed-on: https://gerrit.libreoffice.org/47081 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-26loplugin:passstuffbyref improved return in canvas and svtoolsNoel Grandin2-0/+9
and for now, ignore methods with params so we don't fall into the trap of thinking that calls to methods like: Bar& foo(Bar &p) { return p; } can be converted from Bar f() { return foo(Bar()); } to Bar const & f() { return foo(Bar()); } Change-Id: Ia3795eb2baf353cb6bec4ebf40451f2789d66ad7 Reviewed-on: https://gerrit.libreoffice.org/47034 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-24loplugin:passstuffbyref even more return improvementsNoel Grandin2-1/+15
Change-Id: I2a752025cd429e4d271626402dce5d8a8b0c76d2 Reviewed-on: https://gerrit.libreoffice.org/47021 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-24Fix compilerplugins/clang/test/passstuffbyref.cxxStephan Bergmann1-0/+3
...after 2a1fb4401da16f6a18c0bd05fe4b460a3048f9b5 "loplugin:passstuffbyref improved returns", where compiling as C++17 causes a false positive for S2::set1, whose return statement consists of > `-ReturnStmt 0x9ef8d78 <col:23, col:44> > `-ExprWithCleanups 0x9ef8d60 <col:30, col:44> 'class rtl::OUString' > `-CXXFunctionalCastExpr 0x9ef8d38 <col:30, col:44> 'class rtl::OUString' functional cast to class rtl::OUString <ConstructorConversion> > `-CXXBindTemporaryExpr 0x9ef8d18 <col:30, col:44> 'class rtl::OUString' (CXXTemporary 0x9ef8d10) > `-CXXConstructExpr 0x9ef8cd0 <col:30, col:44> 'class rtl::OUString' 'void (char const &[4], typename libreoffice_internal::ConstCharArrayDetector<char const[4], libreoffice_internal::Dummy>::Type)' > |-StringLiteral 0x9ef7160 <col:39> 'const char [4]' lvalue "xxx" > `-CXXDefaultArgExpr 0x9ef8cb0 <<invalid sloc>> 'libreoffice_internal::Dummy':'struct rtl::libreoffice_internal::Dummy' Change-Id: I7b9de7ce6b5604c7d686c8a4a7034019cd1d75c4 Reviewed-on: https://gerrit.libreoffice.org/47029 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-23loplugin:passstuffbyref improved returnsNoel Grandin2-53/+140
improve the detection of stuff we can return by const &, instead of by copying Change-Id: I479ae89d0413125a8295cc3cddbc0017ed61ed69 Reviewed-on: https://gerrit.libreoffice.org/46915 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-21Allow compiler plugins for onlinePranav Kant4-2/+34
Change-Id: I8e45936ef5675d531be71496e8894b90eaf2f6e2 Reviewed-on: https://gerrit.libreoffice.org/46769 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: pranavk <pranavk@collabora.co.uk>
2017-12-21new loplugin: convertlongNoel Grandin6-343/+183
merge the droplong and convertuintptr into one new plugin. Limit the analysis to looking at var decl's, since that seems to be safest proposition, even if that too needs some careful analysis. Change-Id: Id005baaf05cfb157ce44a06a1c81f08559a07d1f Reviewed-on: https://gerrit.libreoffice.org/46851 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-20Fix for compilerplugins/clang/test/salcall.cxx with clang-clStephan Bergmann1-1/+14
Change-Id: I6e58b6bf0d10297ed3ac20de25c1eea42c9f2334 Reviewed-on: https://gerrit.libreoffice.org/46844 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-20Remove redundant, duplicated getSpellingLoc callStephan Bergmann1-1/+0
Change-Id: Ic1e4fd2833dd0bcc64363733e7794448b2d4de37 Reviewed-on: https://gerrit.libreoffice.org/46839 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-19Bump --enable-compiler-plugins to Clang 3.8.0Stephan Bergmann30-396/+84
<https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html> "Clang baseline bump" Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7 Reviewed-on: https://gerrit.libreoffice.org/46557 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-19remove unused typedefsNoel Grandin1-1/+0
Change-Id: I6fd7a9fed3a80c91a3766fceefd43c5db0aa5275 Reviewed-on: https://gerrit.libreoffice.org/46763 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-19loplugin:unusedfieldsNoel Grandin3-72/+76
Change-Id: I84a7bcb891548416f0e1f1b20059f9b20c890d4c Reviewed-on: https://gerrit.libreoffice.org/46686 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-19loplugin:singevalfieldsNoel Grandin1-56/+20
Change-Id: I28c9e436b9d434ce59394ee195ea39815ae49028 Reviewed-on: https://gerrit.libreoffice.org/46685 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-19loplugin:unusedenumconstantsNoel Grandin2-230/+828
Change-Id: I9dc4b369872a7c6c076ae9be1dcdf2f8385af8a7 Reviewed-on: https://gerrit.libreoffice.org/46684 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-18loplugin:unnecessaryvirtualNoel Grandin1-22/+22
Change-Id: Icf42fdd40a2cf6cda82254f81a7e389c7bac8558 Reviewed-on: https://gerrit.libreoffice.org/46683 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-12-15Enable C++17 for clang-cl, tooStephan Bergmann1-0/+1
Similar to libc++ in C++17 mode, some types like std::auto_ptr are indeed removed in C++17 mode by default, and need _HAS_AUTO_PTR_ETC=1 to be enabled (see <https://blogs.msdn.microsoft.com/vcblog/2017/12/08/c17-feature-removals- and-deprecations/>). Unlike libc++, also std::binary_function and std::unary_function are removed (and need the same _HAS_AUTO_PTR_ETC=1 to enable). So either set that flag to make external code build, or use patches (for external/mdds) to make externals' files included in LO proper still work there. Change-Id: I886cc0de8196255334ee03ec48cb4bc54d460afd Reviewed-on: https://gerrit.libreoffice.org/46514 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-15Try even harder to get at template args in loplugin:implicitboolconversionStephan Bergmann1-13/+26
After f82dc45bdb9e930878447015291c5b90c9325b57 "Use the canonical TemplateDecl", builds on macOS (at least those using C++17 and recent trunk libc++) started to emit false warnings for that std::pair< Reference<XConnection>,sal_Bool> aRet; aRet.second = false; code in dbaccess/source/ui/dlg/DbAdminImpl.cxx. There's a declaration of std::pair in type_traits and a definition in utility, and for some reason the declaration in type_traits was deemed the canonical one, while the SubstTemplateTypeParmType pointed at the definition in utility. So just check both, the original and the canonical TemplateDecl. Change-Id: I2fb9d5172c031e6ad4989b215f19d11a4b17f743 Reviewed-on: https://gerrit.libreoffice.org/46474 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-15loplugin:unusedindex fix false+ in nested loopsNoel Grandin2-11/+28
Change-Id: I31acbf104e49a4d1f077817a68d0b116fd2e0a30