86 Commits

Author SHA1 Message Date
Bjoern Michaelsen
6e226f5ed8 also look for cascading assignments
Change-Id: I7fa18403698530eec379589c76631f0aa367b215
Reviewed-on: https://gerrit.libreoffice.org/12991
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2014-11-20 18:17:03 +00:00
Bjoern Michaelsen
395d6a96aa cascading conditional operators, give a hint on complexity
Change-Id: Ie9d0b07a32cc17705db735ea18f70f28d57badd4
Reviewed-on: https://gerrit.libreoffice.org/12990
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2014-11-20 18:16:02 +00:00
Bjoern Michaelsen
b736204f3b add clang plugin for detecting cascading condops
Change-Id: I1b782bb04b09bee5c3db2261f9390a7b2edf4564
Reviewed-on: https://gerrit.libreoffice.org/12967
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2014-11-19 14:58:40 +00:00
Andrea Gelmini
da40cac540 Fix common typos. No automatic tools. Handmade…
Change-Id: I1ab4e23b0539f8d39974787f226e57a21f96e959
Reviewed-on: https://gerrit.libreoffice.org/12164
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2014-11-12 11:04:11 +00:00
Noel Grandin
5f15cc01b3 new loplugin: use more efficient find() methods
(Original idea from Kendy)
Look for code that is calling std::find on a sorted container
(set/map/vector) and warn about it - the code should be using
the find method on the container itself, since that is considerably faster.

Change-Id: Ib74e5d3faa836eeb0df16a736d202696626bdfd2
2014-11-05 15:59:23 +02:00
Noel Grandin
07ca074e42 cstylecast plugin: ignore templates, improve message
Change-Id: I8347010d5607dc2cbb113b33f1cb2cc78ec106d2
2014-09-29 12:50:35 +02:00
Stephan Bergmann
5a9a3da719 loplugin:nullptr
A plugin to warn about and rewrite null pointer constants that are not written
as nullptr (in C++11 code) resp. NULL (in C and C++03 code).  It is not
activated for the following reasons:

* At least the call to

  pImpl->aFmtNms.insert(pImpl->aFmtNms.begin() + nPos, nullptr);

  in svx/source/items/clipfmtitem.cxx would require
  <https://svn.boost.org/trac/boost/ticket/10540> "missing std::nullptr_t
  support in boost/type_traits/is_pointer.hpp" to be fixed first.

* Additions of code that violate the plugin would probably be frequent, causing
  unnecessary grief for those building with plugins enabled.

* It did not find anything interesting, apart from the above Boost bug and the
  mildly interesting 1da153b617b80887680be65c1854ef8080c2e1c9 "Consistently use
  APP_WRITER as an integer, never as a nullptr."

Anyway,

  until make -O -j4 -k check; do make -O -j1 -k check \
    COMPILER_PLUGIN_TOOL=nullptr UPDATE_FILES=all; done

sucessfully executed on a recent master and resulted in

  6798 files changed, 60919 insertions(+), 60919 deletions(-)

Change-Id: I1260227949868e73fcb63fda13d83e79fde685d7
2014-09-25 17:43:23 +02:00
Tor Lillqvist
dac678d44e Deactivate the sallogareas plugin
It's boring and a waste of time to have to keep registering in
include/sal/log-areas.dox new log areas that other people have introduced.

We don't really have a uniform policy for logging anyway, so why bother trying
to enforce a such for the log areas? Anybody uses whatever log areas and log
output style and formatting they want in the code they happen to be working
on. And that's fine with me. We were supposed to be the project that avoids
unnecessary process, rules and bureaucracy, right?

Change-Id: I6bddcb56b58edcd885e5dc743c8730878de0036d
2014-09-11 09:28:35 +03:00
Stephan Bergmann
889e27c165 codebase is not yet cleaned up for loplugin:cstylecast
Change-Id: Ic2faece46bebea046eee984a0d53d9cd2892e0c9
2014-09-08 09:04:19 +02:00
Juan Picca
9f282bdd86 compilerplugins: Fix tutorials plugins
Broken in commit 1f078fcaddd45bb074e4d0a4933db01f6e8b623e

Change-Id: Ica93c3b9309b2ae4d973ccc34a84b5accac7472c
Reviewed-on: https://gerrit.libreoffice.org/10478
Reviewed-by: Thomas Arnhold <thomas@arnhold.org>
Tested-by: Thomas Arnhold <thomas@arnhold.org>
2014-07-24 08:17:16 +00:00
Stephan Bergmann
9263b101c3 Activate the "suspicious cast to sal_Bool" parts of loplugin:salbool
Change-Id: I78a368ef2899b2462251b45a327fc7b1f31fe764
2014-07-01 17:49:10 +02:00
Noel Grandin
a74193306a compilerplugins: move isUnoIncludeFile to base class
to reduce copy-pasted code

Change-Id: I7728d85dea7d0161998c326d6648ca681a8250d0
2014-06-24 12:48:17 +02:00
Thomas Arnhold
72bc94cc8b salbool: fix comment
accidently removed by 5babf1b9037eb283798322eecd8334e6ff1db655

maybe obsolete now

Change-Id: Id1b8ce21e08ce2df5668252406bad6fb549b5206
2014-04-15 21:22:05 +02:00
Stephan Bergmann
b2ecb3485b Better be specific
Change-Id: Ibb9b5b8f53ab8fdeba6d3db295339ead4bde7b6e
2014-04-15 15:42:00 +02:00
Noel Grandin
ffbc86f5ac add "include/comphelper" to list of includes to ignore
since it only contains a single sal_Bool site now, and we want
to leave that alone since it's a copy of similar stuff in cppuhelper.

Change-Id: I3cf4cf5f67e95d5b6f70371181f77c5451fcbf50
2014-04-15 15:23:28 +02:00
Noel Grandin
5babf1b903 remove unnecessary scope qualifier from sal_Bool uses
i.e. convert "::sal_Bool" to "sal_Bool"

Change-Id: Ie5943aee4fee617bf2670655558927ed25b7e067
2014-04-03 13:54:02 +02:00
Luboš Luňák
f7859e5282 fix filename detection in clang plugins
SourceManager::getFilename() returns "<stdin>" whenever icecream is used.

Change-Id: I4e3e1b90880c5fd2b53f20e4ce3e38e3a0486973
2014-03-23 16:26:53 +01:00
Stephan Bergmann
d44a3aa976 Save the stdexception rewriter plugin used in...
...5e21a413c788f839a66d9e4c14e745ed18058db8 "retrofit std::exception into
overriding exception specs."

Change-Id: If802bbd26b91438f3f46fe18bc763d27967bac5c
2014-02-28 10:44:53 +01:00
Alexander Wilms
15e0b08ab5 Remove visual noise from compilerplugins
Change-Id: Ibfed0b64bd60804fa377b5e25e5f197a7772d605
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
2014-02-27 11:10:28 +01:00
Stephan Bergmann
c850cdc1bc Move plain rewriters to store/ (so they don' get built needlessly)
Change-Id: I62d21e9a579bcb9c116bb272fc1236a890216cd9
2014-02-25 16:34:12 +01:00
Stephan Bergmann
cc478960dc salbool: a rewriting plugin that flags most uses of sal_Bool
...that would not lead to silent changes of the code.  That is, it does not warn
about sal_Bool parameters of virtual functions, so that (not yet rewritten)
overrides do not silently become overloads instead.

The plugin is in store/ for now, because not all of the code has been cleaned up
yet.

Change-Id: I6e9b3847eb26c3090f375045188d38097052defe
2014-02-25 10:48:55 +01:00
Matúš Kukan
37facd4f70 Store compilerplugin warning about classes derived from a specific class.
Useful in case someone wants to find all classes deriving from "foo" and "bar".

Change-Id: I7b12882881712d37976eb8c96fad6e9c9ac01370
2014-02-14 11:11:53 +01:00
Caolán McNamara
3656a57e88 add mode lines to new files (and idls) since last run
Change-Id: Id1e74f18c90e69d1a781c8f02e30dc3c005ed4fd
2013-09-22 12:21:34 +01:00
Luboš Luňák
b0b087cd18 move valueof compiler plugin
The mass-conversion has been already done, so it's most probably
not needed anymore.

Change-Id: I3f161b8ea122e4dd185746ea29509b0d7768d6c7
2013-08-27 18:11:21 +02:00
Luboš Luňák
c352f340c2 note about getDirectCallee() vs getCallee()
Change-Id: I0a4cfd0ddb0c03b0db95d003004195df29a3f6df
2013-08-05 15:10:40 +02:00
Luboš Luňák
015d932735 'generic' compiler plugin to modify calls to a specific function
Change-Id: I60756d9054dfa5c55aeae8ddc904ddf6d67d2088
2013-08-05 15:10:40 +02:00
Luboš Luňák
a0d320096c mark all virtuals in the clang plugin as override
In order to help catch Clang API changes.

Change-Id: I5738f5dff405f7a2dd377c983fb32c1c7a2ff921
2013-05-31 20:00:53 +02:00
Noel Grandin
6a043e9c0a Use the new type-checking Reference constructor to reduce code noise
Also create a Clang compiler plugin to detect such cases.

Change-Id: I61ad1a1d6b1c017eeb51f226d2dde0e9bb7f1752
Reviewed-on: https://gerrit.libreoffice.org/4001
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2013-05-22 10:44:29 +00:00
Luboš Luňák
e6c20364e7 add const
Change-Id: I71236b9ca6300372ba00c85401cf19f6c0e7ac99
2013-05-02 18:19:59 +02:00
Luboš Luňák
b8dd396976 base for unusedcode compiler plugin
Needs work to actually do something useful, but the basics are there.

Change-Id: I193922f2f5572760c8c20def0f9b830138f47fef
2013-04-22 17:56:47 +02:00
Luboš Luňák
5f8a2dc398 removeforwardstringdecl clang plugin has been used, move it
Change-Id: I3bccfa773448e17ac3c8ece6b99f85c6d399b0cf
2013-04-07 14:23:12 +02:00
Luboš Luňák
c63e6c38c9 adjust unused compiler plugins for ASTContext to CompilerInstance change too
Change-Id: I415ed25586408d7e7df9457f7c637a8c6d13d35d
2013-03-28 18:08:05 +01:00
Tor Lillqvist
616c6924f1 s/the the/the/
Change-Id: Iadacffaad832c6ff06757e8567e24f929f24a4c3
2013-02-22 09:58:19 +02:00
Luboš Luňák
4fd910a096 tutorial examples for writing new Clang plugin actions
http://wiki.documentfoundation.org/Clang_plugins

Change-Id: Ieb4fc186490e81ab961c094ca0a7fcdabc0f348f
2013-02-02 22:59:46 +01:00
Luboš Luňák
276953ef21 remove not needed #include
Change-Id: I0fa791733407199db5be2cc9606ac9be1da64188
2013-02-02 22:59:45 +01:00
Luboš Luňák
108a95630d move clang plugin that's no longer needed
But still keep it in case it'd be needed again, or simply
as a starting reference.

Change-Id: If519e1320e1bd6dce7746b57172324b33504051e
2013-02-02 22:59:44 +01:00