summaryrefslogtreecommitdiff
path: root/compilerplugins
AgeCommit message (Collapse)Author
2017-11-10loplugin:unusedmethodsNoel Grandin
Change-Id: I543b0943f0bc918d59debc8ee051f88c29d18454 Reviewed-on: https://gerrit.libreoffice.org/44553 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-10No need to check both (identical) param_size() and getNumParams()Stephan Bergmann
Change-Id: I481cfa8b0f4bb9cbc257d28f36c372fb7367f294
2017-11-09connectivity: fix loplugin:datamembershadow warning in the Calc driverMiklos Vajna
Change-Id: Idcc6b1734599eec5d9eefbefb8849dc050b6a9d6 Reviewed-on: https://gerrit.libreoffice.org/44522 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2017-11-09loplugin:unusedvariable add some more std:: typesNoel Grandin
Change-Id: Ib15931e415990b56367fe3e1c7cf3f22cc4826d5 Reviewed-on: https://gerrit.libreoffice.org/44529 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-09loplugin:unusedfieldsNoel Grandin
Change-Id: Ie8a2c6462ddc708140e725847199c8234ab6b592 Reviewed-on: https://gerrit.libreoffice.org/44528 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-09No need to blacklist this loplugin:unnecessaryoverrideStephan Bergmann
This now hides one of the ScVbaFormatCondition_BASE::Operator overloads, but that doesn't get called directly at ScVbaFormatCondition anyway. (And if it were, we could add an appropriate using declaration to ScVbaFormatCondition.) Change-Id: I8440b76a5745c6874f7a3bfcbb4bc4ce5618a4c4
2017-11-09new loplugin simplifydynamiccastNoel Grandin
simplify dynamic_cast followed by static_cast Change-Id: I965afcf05d1675094cfde53d3590a0fd00f26279 Reviewed-on: https://gerrit.libreoffice.org/44460 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-09loplugin:unnecessaryvirtualNoel Grandin
Change-Id: I5696c853daa16c9e55ff046d67102ba3042bfea8 Reviewed-on: https://gerrit.libreoffice.org/44459 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-08Fix loplugin::unusedvariablecheck check for std classesStephan Bergmann
(but which finds no new hits) Change-Id: I862a3c82932ee6d6d0946cd33f965bb8e917cff8
2017-11-08Drop HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STLStephan Bergmann
For one, loplugin:unusedvariablecheck does not merely check for unused variables with types from the standard library since fe2164949b38a7f73883dbdcb3271b94e5c81744 "teach unusedvariablecheck plugin about SfxPoolItem subclasses", so disabling loplugin:unusedvariablecheck based on HAVE_GCC_ATTRIBUTE_WARN_UNUSED_STL is wrong. For another, I have seen no standard library implementation that decorates its types with such "warn-if-unused" attributes, and <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0600r0.pdf> "[[nodiscard]] in the Library" (which proposes to add the corresponding C++17 attribute to just a few select functions and no types at all) makes it appear unlikely that will happen. Change-Id: I0a7759e1caf3e3137057c9689080948a4d6747e0
2017-11-08Fix loplugin:flatten's skipping of if/then/else/if chainsStephan Bergmann
(but which finds no new hits) Change-Id: I5d5f351402797b662a08ec8dca301bd174e22a50 Reviewed-on: https://gerrit.libreoffice.org/44433 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-08Remove obsolete "lo_warn_unused" workaroundStephan Bergmann
Per README.md, Clang 3.4 is the baseline for --enable-compiler-plugins, which is the sole consumer of the "lo_warn_unused" attribute, but Clang 3.4 already supports HAVE_GCC_ATTRIBUTE_WARN_UNUSED. Change-Id: I9654028e24852335e463c73bcb5ece5e5b54d53c
2017-11-08Suppress loplugin:unnecessaryoverride...Stephan Bergmann
...when a class derives from multiple (non-virtual) instances of one base class, and the override disambiguates which of those instances' member to call. That was the case with SwXTextDocument::queryAdapter (sw/source/uibase/uno/unotxdoc.cxx), where SwXTextDocument derives from cppu::OWeakObject through both SwXTextDocumentBaseClass and SfxBaseModel, but calling queryAdapter through a pointer to SwXTextDocumentBaseClass apparently needs to call OWeakObject::queryAdapter on the second, SfxBaseModel-inherited OWeakObject base instance, or else CppunitTest_sw_macros_test fails. Who knows what other instances of similar non-unnecessary overrides have been removed with the help of broken loplugin:unnecessaryoverride, for which there were no tests that started to fail... Turns out .clang-format lacked "ReflowComments: false" to not break the special "// expected-error {{...}}" etc. comments in compilerplugins/clang/test/. Also, use a better location to report loplugin:unnecessaryoverride, to keep clang-format and loplugin:unnecessaryoverride from fighting over how to split lines and where to put the comment in compilerplugins/clang/test/unnecessaryoverride.cxx. Change-Id: I3b24df24369db12f8ec1080d6c9f7b70ff561a16 Reviewed-on: https://gerrit.libreoffice.org/44418 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-11-07Remove obsolete commentStephan Bergmann
...that should have been removed in 2446d2b2fb8b091eaae015fd5bb26bd8e0f596f7 "Avoid expensive calls to containsPreprocessingConditionalInclusion" Change-Id: I2ffe0ec7b6f1ec0b418979f2864bd5de79ab2c9a
2017-11-07Avoid expensive calls to containsPreprocessingConditionalInclusionStephan Bergmann
Change-Id: I42981a23f75298591b2c3b073aea66426220f3e2
2017-11-07loplugin:constparams in sdNoel Grandin
Change-Id: Id4b68ca0509111396ed354f4cda43d663083cad0 Reviewed-on: https://gerrit.libreoffice.org/44388 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-07Clean away temporarily added using declarationsStephan Bergmann
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-11-07Memoize ignoreLocation resultsStephan Bergmann
...which, according to callgrind, reduces instruction fetch count spent on compiling sw/source/core/layout/paintfrm.cxx (randomly selected because it is rather large) by 5% from 41,992,064,226 to 39,861,989,855 (function main() in clang-6.0). This is best done by forwarding ignoreLocation calls from Plugin to the PluginHandler signleton, but due to the tight mutual coupling between plugin.hxx and pluginhandler.hxx that unfortunately required some reorganization (and two outstanding TODO clean-ups of temporarily introduced using declarations in plugin.hxx). Change-Id: Ia4270517d194def7db7ed80cb6894e9c473e9499
2017-11-02improve constparam lopluginNoel Grandin
lots of little fixes to make the logic less pessimistic Change-Id: If368822984250b11b98c56f5890177a1402e8660 Reviewed-on: https://gerrit.libreoffice.org/44168 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-11-01-I$(dir $(3)) in gb_CObject__command_pattern is no longer neededStephan Bergmann
...at least in com_GCC_class.mk (com_MSC_class.mk will be addressed in a follow- up commit), after the recent loplugin:includeform clean-up. Two static libraries built from external sources needed adjustment, two compilerplugin tests needed adjustment (which wasn't found by loplugin:includeform, by design), and one more adjustment in sal/textenc/generate/. Change-Id: Idad5ae355a02ae130369a9a45b5f5925ab48ffef Reviewed-on: https://gerrit.libreoffice.org/44174 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-30new loplugin: constmethodNoel Grandin
parked in store/ for now, because, as I worked my way up the layers of modules, the higher I got, the more false+ I got when trying to only make changes that preserved logical-constness. Change-Id: I4acd2c4416775f7c6a3d91eb0bce048630ccaff5
2017-10-27Adapt loplugin:includeform to Windows \ path separatorStephan Bergmann
This can also call loplugin::isSamePathname with two paths that both contain backslashes, so finally make it (and hasPathnamePrefix) symmetric in which arguments my contain backslashes. Change-Id: I0465988d9d41e21c5660cbdbd1558543860ae1ad
2017-10-27revert small part of previous commitNoel Grandin
not necessary after all Change-Id: I050ed0cc140969f2d32839f3a7841b240fd0efd0
2017-10-27extract some common code for checking if a functions address was takenNoel Grandin
Change-Id: I292b4e9bf17c83f83ff43ac4c5870d33092d0c71
2017-10-27-Werror=unused-functionStephan Bergmann
Change-Id: I2858c6cb74b96ffe6a799dc2ab02cbbe1c56abc7
2017-10-27loplugin:constantparam was not always using canonical location for functionNoel Grandin
Change-Id: I8a15da534ba2cf9968cba0ee1f1bb74d7e3a0d54
2017-10-27no need to build the parent tree twiceNoel Grandin
lets just use the built in parents stuff Change-Id: I7bb705acfcd6c8c18168676b0cdb13c26ba5b95a
2017-10-27rename loplugin::Plugin::parentStmtNoel Grandin
to getParentStmt and rename parentFunctionDecl to getParentFunctionDecl, so I don't keep using accidentally naming my variables the same as the functions. Change-Id: I66f9452458c8b439e5132191ac5219fb6d420708
2017-10-26Make loplugin:implicitboolconversion find the same in C++17 and pre-C++17Stephan Bergmann
...see a2d814ac1d7beb6fbe4b9cb7b75814f4b08b8e59 "loplugin:implicitboolconversion" and 24eeb4d286471e4a2103c15efc624a565112ca32 "loplugin:implicitboolconversion" for things previously only found in C++17. As expected, no further occurrences were found. Change-Id: Id0ab621b82dc3c40c8b5801413fceb73ade1408a
2017-10-26Use compat::getSubExprAsWritten; clean upStephan Bergmann
Change-Id: I8f984c3b3833437f6b4d65ab99da608a6868ff74
2017-10-26More loplugin:unnecessaryparenStephan Bergmann
81892b2037453108b9bde1512a500cf3b2ce438a "loplugin:unnecessaryparen when compiling as C++17, so the ParenExpr is no longer hidden behind ExprWithCleanups/CXXConstructExpr/MaterializedTemporaryExpr wrappers" gave me the idea to generally look though IgnoreImplicit instead of IngoreImpCasts in loplugin:unnecessaryparen. However, that would still not look through implicit CXXConstructExpr, so would still not have found the occurrences in 81892b2037453108b9bde1512a500cf3b2ce438a when compiling in pre-C++17 mode. Therefore, let ignoreAllImplicit also look through CXXConstructExpr. (I am not entirely sure in which situations non-implicit CXXConstructExpr---that should thus not be ignored---would occur, but assume they would be underneath something like a CXXFunctionalCastExpr, which is not ignored.) Change-Id: I947d08742e1809150ecc34a7abe84cca5e0ce843
2017-10-25new loplugin:dodgyswitchNoel Grandin
and fix bug in ScriptDocument::getTitle which has been there since commit e304ba66f4aba5cc55612508b5738a1ed26a7904 Date: Thu Mar 15 14:59:30 2007 +0000 INTEGRATION: CWS basmgr02 (1.1.2); FILE ADDED plugin is off by default since it uses expensive parentStmt() calls Change-Id: Id0f16baec48e0381e0083594d7e59b58b023da2f Reviewed-on: https://gerrit.libreoffice.org/43750 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-24loplugin:includeformStephan Bergmann
Consistently use the #include "..." form for exactly those cases where the included file is located next to the including file, see the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2017-October/078601.html> "C[++]: Normalizing include syntax ("" vs <>)". (For UNO API include files, see 189abcf0db61c41a565bd355294bf6e712fc3e5a "loplugin:includeform: UNO API include files".) (Some of the commits done earlier with messages containing "Change done in preparation of loplugin:includeform" etc. were based on a somewhat different earlier version of this plugin and would not be necessary with the current form. But they are harmless and reverting them would probably cause more noise than benefit, so just leave them in.) Change-Id: I9fe9268ed84d31b5df71857a2e535972b11254ce Reviewed-on: https://gerrit.libreoffice.org/43730 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-22loplugin:redundantcast: Do warn about convoluted dynamic_cast to selfStephan Bergmann
...that the compiler is free to elide anyway. (See 4e7ffc0a69dac31ca7e0f1649f1697a1ff8d6e5f "Avoid compiler eliding#redundant dynamic_cast" and 380d6afe5fd691f6ad4b17fc38b79b9fca4ba906 "Remove redundant asserts involving dynamic_cast".) Change-Id: I3f75154fee3e978b7ba95a5a27589417065599bd
2017-10-22Make sure TypeCheck has a non-deleted default ctorStephan Bergmann
...as needed by > core/compilerplugins/clang/check.cxx:19:19: error: call to implicitly-deleted default constructor of 'loplugin::TypeCheck' > ? *this : TypeCheck(); > ^ > core/compilerplugins/clang/check.hxx:76:5: note: explicitly defaulted function was implicitly deleted here > TypeCheck() = default; > ^ > core/compilerplugins/clang/check.hxx:78:27: note: default constructor of 'TypeCheck' is implicitly deleted because field 'type_' of const-qualified type 'const clang::QualType' would not be initialized > clang::QualType const type_; > ^ after https://llvm.org/svn/llvm-project/cfe/trunk@315194 "Make SourceLocation, QualType and friends have constexpr constructors" defaulted the clang::QualType ctor. Change-Id: Idaeaa4499cea877fd5d66c18b8fce24b7808ba04
2017-10-21loplugin:redundantcast handle dynamic_castNoel Grandin
Change-Id: I7855c76e820efce96778b1c19ec71dffcc4b4abb Reviewed-on: https://gerrit.libreoffice.org/43621 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-21Avoid loplugin:faileddyncast for "unnecessary", up-casting dynamic_castStephan Bergmann
Change-Id: Iecb943db0aff7ffc21cc2f6adb625be369255b32 Reviewed-on: https://gerrit.libreoffice.org/43606 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-20Fully ignore inappropriately named loplugins in unit-test modeStephan Bergmann
...even if they implement PPCallbacks, so filtering them out in HandleTranslationUnit was ineffective. Change-Id: I9df8103a50739f3176e6d63accfd0334da7faa9a Reviewed-on: https://gerrit.libreoffice.org/43575 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-18rename some fieldsNoel Grandin
in preparation for const-method detection Change-Id: Iecf7102892d664ded799615ce1a848a538dcfcef
2017-10-18loplugin:manualrefcountNoel Grandin
this is the code I used to find naked acquire/release stuff No need to run it all the time, so leave it in store Change-Id: I9ac4a6f5db7cd4cbb1b63698340425eed7cb8713
2017-10-17Move lotuswordpro include files to common include directoryStephan Bergmann
...that are included from both lotuswordpro/source/filter and lotuswordpro/source/filter/xfilter. Change done in preparation of loplugin:includeform. Change-Id: I7b65d3232e164af662b7de5bb49d59597803d41c Reviewed-on: https://gerrit.libreoffice.org/43453 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-17loplugin:finalclasses trim the output a littleNoel Grandin
Change-Id: Iad0f0ded624e95448421c19a04535c2511b66a02
2017-10-16Move svx include files to common include directoryStephan Bergmann
...that are included from various source directories. Change done in preparation of loplugin:includeform. Change-Id: I9191e80aa721c376f17219e4d10eb83929e38e14
2017-10-11Use unique class names for better FlameGraph resultsStephan Bergmann
...of measuring loplugin performance, when gathering data with perf and all plugins that used "Visitor" as class name were lumped together. (Cf. <https://whatofhow.wordpress.com/2016/06/28/plugin-flamed/>.) Change-Id: Ie482f443faced7469528da4772e735bc2eda596d Reviewed-on: https://gerrit.libreoffice.org/43324 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-09Move loplugin:bodynotinblock to store/, to improve performanceStephan Bergmann
...as it was the last remaining enabled-by-default plugin that calls expensive parentStmt. It isn't immediately clear to me how to rewrite the plugin to not call that, but a superset of this plugin's warnings are now also emitted by GCC 6 -Wmisleading-indentation. Change-Id: Ifa55cb14f6763594fe48926585df29d4d30355df
2017-10-06disable constparams lopluginNoel Grandin
increases compile time too much, I will run this by hand periodically Change-Id: I118567ef294847ff609d4de771d998ce3b57161b
2017-10-06Improve performance of loplugin:flattenNoel Grandin
...by avoiding calls to parentStmt. Change-Id: I4f3d66a0529e9c3abf5c963bcf70db7a2afa1bf9
2017-10-06Improve performance of loplugin:commaoperatorStephan Bergmann
...by avoiding calls to parentStmt, thereby also improving the precision of exactly which comma operators to ignore (which turned up a handful more finds). Also added tests. Change-Id: Ie74f824fd7f54131aab09b59086452fb4f3ff827 Reviewed-on: https://gerrit.libreoffice.org/43181 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-05loplugin:finalclasses in vclNoel Grandin
Change-Id: I7de9cd6c5569217aa8d379c6d112cd1874bca8e2 Reviewed-on: https://gerrit.libreoffice.org/43151 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-10-05Also suppress loplugin:flatten in C++ class member functions...Stephan Bergmann
...invovling preprocessing conditionals, to actually make the unhelpful warning on Windows about OleEmbeddedObject::changeState go away. And while at it, make the check for preprocessing conditionals more targeted (similar to 1084e8be44661aaeacb8801707701013eb3fcdbc "More targeted check for preprocessing conditionals in loplugin:blockblock"). Change-Id: I0300e0a547e969520a90cd126ea8f788cc17560f Reviewed-on: https://gerrit.libreoffice.org/42975 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>