20 Commits

Author SHA1 Message Date
Noel Grandin
dce867e8c4 loplugin:stringconstant handle calls to constructors with one arg
Change-Id: Ide9148a908bef46ba14640dfa6f556beaf6e3f60
Reviewed-on: https://gerrit.libreoffice.org/33772
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-02-01 07:57:16 +00:00
Noel Grandin
1c3e84d819 teach lolugin:stringconstant about calling constructors
so we can remove unnecessary calls to the OUString(literal) constructor
when calling constructors like this:
   Foo(OUString("xxx"), 1)

Change-Id: I1de60ef561437c86b27dc9cb095a5deb2e103b36
Reviewed-on: https://gerrit.libreoffice.org/33698
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-31 08:56:20 +00:00
Noel Grandin
4511431fb6 improve "unnecessary user-declared destructor" check
to look for inline&empty destructors, where we can just let
the compiler do it's thing

Change-Id: Ibde8800bdfed6b77649c30ebc19921167c33dec3
Reviewed-on: https://gerrit.libreoffice.org/32999
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-01-27 09:49:04 +00:00
Stephan Bergmann
aee1d799be Make test work with older Clang
For some reason, e.g. Clang 3.8.1 doesn't evaluate std::strlen here (though it
apparently does in other places in this file).

Change-Id: Ib2b7dcc1d7b6ae47ef285bd2edb65e399dc11b79
Reviewed-on: https://gerrit.libreoffice.org/33547
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-01-26 08:36:51 +00:00
Tor Lillqvist
907a9ce8b8 Bypass some lines that cause problems with Clang 3.8.1 at least
Change-Id: I05202ee6b2f083e8aacf0a2a8f8d7b8b361a5df8
2017-01-25 11:56:54 +02:00
Stephan Bergmann
236f69e710 Minor loplugin:stringconstant improvements
Change-Id: I0b39526c0f0854ddbb29e77ece303cf2bdd842c4
2017-01-25 07:58:10 +01:00
Stephan Bergmann
ce38f88151 New loplugin:externvar
Change-Id: Ie5404f11cbc5b05bd18455ae81526eb2de01548c
2017-01-09 15:44:47 +01:00
Stephan Bergmann
9d7802e7fc Make move detection in loplugin::passstuffbyref work for parenthesized cases
Change-Id: I56754a718af9433c0fa654ccb8eb34da00e75420
2016-12-16 15:16:37 +01:00
Stephan Bergmann
a9659f30d6 No need for rtl::Reference friend, no need for #include vclptr.hxx
Change-Id: I7bdd15a93e728ef7e98a53001c6eb6b56f761a6d
2016-12-09 20:01:52 +01:00
Miklos Vajna
dc1925e6f0 sw: remove some inline version control in uibase
Change-Id: I7125b6f8593cac2c33916341f5649f57044ad045
Reviewed-on: https://gerrit.libreoffice.org/31761
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
2016-12-08 16:24:12 +00:00
Stephan Bergmann
03c215ab07 loplugin:unnecessaryoverride (dtors)
Change-Id: Ia38672028668959bf3d5541fe4ddb9fb72848617
2016-12-05 09:06:14 +01:00
Noel Grandin
8cf59c6743 make passstuffbyref plugin ignore std::move'd params
request from vmiklos

Change-Id: If263beb0623d725e406003bb1660df10fe4b4e35
Reviewed-on: https://gerrit.libreoffice.org/31555
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-12-05 05:53:25 +00:00
Noel Grandin
e6ffb539ee loplugin:vclwidgets check for assigning from VclPt<T> to T*
Inspired by a recent bug report where we were assigning the result
of VclPtr<T>::Create to a raw pointer.

As a consequence, we also need to change various methods that were
returning newly created Window subclasses via raw pointer, to
instead return those via VclPtr

Change-Id: I8118e0195a5b2b4780e646cfb0e151692e54ae2b
Reviewed-on: https://gerrit.libreoffice.org/31318
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-29 06:45:42 +00:00
Stephan Bergmann
f1eb0bf752 Clean up CLANG_VERSION check
Change-Id: Idfdffd73e9029216775d2a6ad46293ee1a4f1308
2016-11-25 11:24:12 +01:00
Miklos Vajna
7aa2b5a041 CompilerTest_compilerplugins_clang: fix this to work with clang-3.7
Change-Id: I653b9c3aba53da421592b230bee3a9b69d3cb2d7
2016-11-24 12:11:59 +01:00
Stephan Bergmann
0de1b34a89 New loplugin:oslendian
...to catch new places where defined'ness of OSL_BIG/LITENDIAN would be checked
without osl/endian.h being included; cf.
e2f08f9def0869460ad38a1c2adb450778290f6e "connectivity, sc: add missing #include
<osl/endian.h>" and 2b14fb3a4f92b928f0a5fc536c6a5f4a6e51a9b8 "cppcanvas, oox:
add missing #include <osl/endian.h>".

Change-Id: I167c8916a01391b7dacad7325153ccf35d3ba9dc
2016-11-22 10:54:25 +01:00
Noel Grandin
04f262ace0 new loplugin datamembershadow
Change-Id: Ib14319848bafd1fe7e0e663c434bbdeef5e98ecf
Reviewed-on: https://gerrit.libreoffice.org/30963
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-21 06:19:52 +00:00
Stephan Bergmann
1034ee0c09 Reduce noise for irrelevant warnings somewhat
...other options to avoid such irrelevant warnings can be to move code to an
include file and/or to define a dummy main() accessing otherwise unreferenced
entities.

Change-Id: Ifd44e376b35ef68496f3aba6a3c046d684824000
2016-11-16 11:10:39 +01:00
Noel Grandin
7cca2c7fb3 new loplugin finalprotected
look for final classes, and make sure they don't have protected members

Change-Id: I1fa810659bba02b61a5160dbfd8e24185ec9abf4
Reviewed-on: https://gerrit.libreoffice.org/30895
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-11-16 09:10:16 +00:00
Stephan Bergmann
645583dfd3 New compilerplugins/clang unit tests
...to check that loplugin produces warnings/errors as expected:

* Clang has a -verify switch that makes it easy to write test input .cxx files
  that list in comments all the warnings/errors that are expected, and let Clang
  check those expectations instead of generating object code.  See
  include/clang/Frontend/VerifyDiagnosticConsumer.h in the Clang source tree for
  documentation.

* Introduce a CompilerTest gbuild class that uses the existing LinkTarget class
  as much as possible.  Checking the input files is implicitly phony, as the
  compilation step doesn't generate any object files, and the link step does
  nothing because there is no gb_LinkTarget_set_targettype for CompilerTest.
  The setup at least works for Clang on Linux (will need adaptions for Clang on
  Windows; compilers other than Clang are not relevant for now given this is
  used to check compilerplugins).

* Definition of gb_CFLAGS_WERROR in solenv/gbuild/platform/com_GCC_defs.mk needs
  to be lazy ('=' vs. ':=') so that CompilerTest can override it:  The Clang
  -verify mode wants the input files to specify whether the loplugin diagnostics
  are warnings or errros, so they consistently need to be errors independent of
  --enable-werror configuration.

* A first (example) test is in compilerplugins/clang/test/salbool.cxx.  The
  corresponding gbuild CompilerTest instance is in
  solenv/CompilerTest_compilerplugins_clang.mk for now.  The reason for that odd
  split across compilerplugins/ and solenv/ is that there is no
  compilerplugins/Modules_compilerplugins.mk file, so this setup is the easiest
  hack for now (to be cleaned up).  (Another area that could be improved is that
  all test files need to be listed explicitly in the CompilerTest_*.mk file,
  instead of, say, using all .c/.cxx/.m/.mm files in a specified directory.)

* The test is run somewhat late during a top-level 'make', after loplugin has
  already been used in compilation.  But it can be run manually (e.g., 'make
  solenv') when making changes to loplugin during development.

Change-Id: I01e12fb84887d264ac03ef2484807458c2075af4
2016-11-15 11:09:29 +01:00