Commit Graph

1081 Commits

Author SHA1 Message Date
Stephan Bergmann
314f15bff0 Extend loplugin:external to warn about enums
To mitigate the dangers of silently breaking ADL when moving enums into unnamed
namespaces (see the commit message of 206b5b2661
"New loplugin:external"), note all functions that are affected.  (The plan is to
extend loplugin:external further to also warn about classes and class templates,
and the code to identify affected functions already takes that into account, so
some parts of that code are not actually relevant for enums.)

But it appears that none of the functions that are actually affected by the
changes in this commit relied on being found through ADL, so no adaptions were
necessary for them.

(clang::DeclContext::collectAllContexts is non-const, which recursively means
that External's Visit... functions must take non-const Decl*.  Which required
compilerplugins/clang/sharedvisitor/analyzer.cxx to be generalized to support
such Visit... functions with non-const Decl* parameters.)

Change-Id: Ia215291402bf850d43defdab3cff4db5b270d1bd
Reviewed-on: https://gerrit.libreoffice.org/83001
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-17 00:28:17 +01:00
Caolán McNamara
1e164a6ad4 cid#1448329 Wrapper object use after free
Change-Id: I2c0352fee1621f03604409f9899cc1f9e8a6cbf8
Reviewed-on: https://gerrit.libreoffice.org/82717
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-14 20:29:57 +01:00
Gabor Kelemen
7ddedd2594 tdf#42949 Fix IWYU warnings in basic/
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I325149be2ea7697b5b4a2ce4a662edd2f8be6e50
Reviewed-on: https://gerrit.libreoffice.org/82312
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-12 09:20:55 +01:00
Caolán McNamara
5d1be8f1d2 cid#1448492 Wrapper object use after free
Change-Id: I4c5978b019549d1509c4c70b4cfa93a362395fed
Reviewed-on: https://gerrit.libreoffice.org/82448
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-11 17:56:44 +01:00
Caolán McNamara
2297f04269 call GetSbData just once
Change-Id: Idb63c169c7e39f27bc99e3c3aa9155583f2a65ab
Reviewed-on: https://gerrit.libreoffice.org/82431
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-11-11 14:34:37 +01:00
Caolán McNamara
10c9fe853a Related: cid#1448329 call GetSbData() just once
rather than every time its result it needed to deconvolute this a
layer

Change-Id: I1a611ed2bd74e682501cf8cbd64a5e285ec1c7e9
Reviewed-on: https://gerrit.libreoffice.org/81628
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-10-29 09:18:00 +01:00
Stephan Bergmann
1efe1f82fa In checkUnoObjectType, check for derived-from types too
As discussed in the mail thread starting at
<https://listarchives.libreoffice.org/global/users/msg54775.html>
"[libreoffice-users] Experimental macro features: How to determine object
types?", it is confusing if a variable dim'ed as
com.sun.star.util.XSearchDescriptor cannot hold an object whose
css.lang.XTypeProvider::getTypes only reports css.util.XReplaceDescriptor (which
is derived from XSearchDescriptor) but not XSearchDescriptor itself.

At least for now, keep the odd endsWithIgnoreAsciiCase check intact (instead of
checking for strict equality).

Change-Id: Idd8ae8cb11b0f2e9c6369842629fc5a21e1c5cc5
Reviewed-on: https://gerrit.libreoffice.org/81386
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-23 18:14:37 +02:00
Stephan Bergmann
47d813eabb Remove check that is redundant
...since 96710f8e46 "convert OUString::match to
OUString::endsWith"

Change-Id: Ifd08feede5908e6cc41b25bfe9f8bde6c6d6930b
Reviewed-on: https://gerrit.libreoffice.org/81362
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-23 10:49:53 +02:00
Noel Grandin
cdbac696fb simplify "a = a +" to "a +="
mostly so that my stringadd loplugin can point out places to improve

Change-Id: I9920ee1c99cdb6b811ba67ff9d8e32aa261884b5
Reviewed-on: https://gerrit.libreoffice.org/80618
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-10-11 07:18:11 +02:00
Noel Grandin
b56a4eaf5e add property name when throwing css::uno::UnknownPropertyException
Change-Id: I17f06c9415b9d43b6d8896360e07216c2856367a
Reviewed-on: https://gerrit.libreoffice.org/79627
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-26 18:32:25 +02:00
Mike Kaganski
2acc0b3b63 Remove redundant clears
Change-Id: Id95a33bd7f2a89791e140bf0cb51b59c06a2c65e
Reviewed-on: https://gerrit.libreoffice.org/79054
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-09-17 13:55:36 +02:00
Andrea Gelmini
22ef2a15bb Fixing "...."
Change-Id: Id005a7531d546dd43de13b49bcb3e93081c5ad8d
Reviewed-on: https://gerrit.libreoffice.org/78679
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-09-06 09:15:58 +02:00
Noel Grandin
f1ec3c675f loplugin:constmethod in basic
Change-Id: Ib2056ab8437e163c7ae42e3ab7a4a3f8b6cb80a2
Reviewed-on: https://gerrit.libreoffice.org/78547
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-09-03 15:14:00 +02:00
Andrea Gelmini
ee8f0a1066 Fix '..'
To complete this:
https://gerrit.libreoffice.org/#/c/78312/

This is a massive replace for
".." instead of "..." between words.

It passed "make check" on Linux.

Change-Id: I144d8061fca9f545c762941551e59dffdd3650e8
Reviewed-on: https://gerrit.libreoffice.org/78357
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
2019-09-01 12:29:39 +02:00
Noel Grandin
889dc7bffa use more TOOLS_WARN_EXCEPTION
Change-Id: Ic21ea11ff106e0732bb8fa600ef39a549d7bda86
Reviewed-on: https://gerrit.libreoffice.org/77569
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-16 13:31:26 +02:00
Stephan Bergmann
d204b7f787 Improved loplugin:stringconstant (now that GCC 7 supports it): basic
Change-Id: I174b057e29e5c0d56534fb1d2b6240880c7ddf2b
Reviewed-on: https://gerrit.libreoffice.org/76695
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-07-31 13:00:51 +02:00
Andrea Gelmini
afad1a0cbc Fix typos
Change-Id: Ib778a6598f3797fe871a25b56b7b4b7761889296
Reviewed-on: https://gerrit.libreoffice.org/76269
Tested-by: Jenkins
Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
2019-07-24 23:34:49 +02:00
Noel Grandin
ee2bb23103 loplugin:referencecasting in avmedia..basic
Change-Id: I6790b2e3902d64fb6f714f031affa221dbaba014
Reviewed-on: https://gerrit.libreoffice.org/75934
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-07-19 12:22:43 +02:00
Noel Grandin
cdcc2f365b loplugin:logexceptionnicely in accessibility..basic
Change-Id: I6e0b95b40e3d62db36352f3ea916f79f3dbc9084
Reviewed-on: https://gerrit.libreoffice.org/74018
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-14 11:29:43 +02:00
Arkadiy Illarionov
c88f76035c Use hasElements to check Sequence emptiness in accessibility..canvas
Similar to clang-tidy readability-container-size-empty

Change-Id: I24c3f04b4eed3c1cd973166885660f113a26844f
Reviewed-on: https://gerrit.libreoffice.org/71805
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-06-11 20:24:40 +02:00
Stephan Bergmann
49c88d8b23 -fsanitize=nullability
Change-Id: I27336c512ed0b46b32344a05611e6ba17e45adef
Reviewed-on: https://gerrit.libreoffice.org/73023
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-05-27 15:24:46 +02:00
Caolán McNamara
fbc038cc4f an uno -> a uno
Change-Id: I538db88f8477dd2d2ad25c372928fec6c11d979d
Reviewed-on: https://gerrit.libreoffice.org/72105
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2019-05-10 14:50:59 +02:00
Stephan Bergmann
0e335af4d3 Fix uses of variables before their lifetimes begin
All of those have been broken with recent loplugin:sequentialassign changes (and
have been found with a new plugin to be commited).

The code in SbUnoClass::Find (basic/source/classes/sbunoobj.cxx) looks
suspicious, but has been effectively like that ever since at least
c25ec0608a "initial import", so just marked it
with a TODO comment for now.

Change-Id: I0d691cb55ef317cf2b16b0490169de7ec97375cf
Reviewed-on: https://gerrit.libreoffice.org/70874
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-04-17 18:56:04 +02:00
Noel Grandin
d028c1be17 loplugin:sequentialassign in accessiblity..canvas
Change-Id: I984717138ac85c1af5fc363fda06f5c2b5497965
Reviewed-on: https://gerrit.libreoffice.org/70641
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-04-12 13:06:26 +02:00
Andrea Gelmini
1a0250c6b8 Fix typo
Change-Id: I27f9b30f76b6bbd255a346c00d64e2499e7f3b5e
Reviewed-on: https://gerrit.libreoffice.org/70360
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-07 08:04:52 +02:00
Andrea Gelmini
533d51519c Fix typo
Change-Id: I9df2f892066d5072f63f5bf68e1f9b2aa3905772
Reviewed-on: https://gerrit.libreoffice.org/70229
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-04-04 07:52:17 +02:00
Mike Kaganski
184be2d135 tdf#120703 PVS: remove redundant static casts
V572 It is odd that the object which was created using 'new' operator
     is immediately cast to another type.

Change-Id: I54976062dc3f62eaaa79f89eff54454f0b24ac2c
Reviewed-on: https://gerrit.libreoffice.org/69989
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2019-03-31 07:27:24 +02:00
Arkadiy Illarionov
10a48c737d Simplify containers iterations in basctl, basegfx, basic, bridges
Use range-based loop or replace with STL functions

Change-Id: I8594740103bdc2091c2d03d4b92bbe8393f5378c
Reviewed-on: https://gerrit.libreoffice.org/69223
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-16 20:16:46 +01:00
Gabor Kelemen
754c6af45a tdf#42949 Fix IWYU warnings in include/basic/*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I9dd7984affc4343f148c66077feaac19176adf51
Reviewed-on: https://gerrit.libreoffice.org/68769
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-03-07 14:20:10 +01:00
Noel Grandin
8b5e23eac3 log nice exception messages whereever possible
Change-Id: Idd125c18bee1a39b9ea8cc4f8c55cddfd37c33e1
Reviewed-on: https://gerrit.libreoffice.org/68579
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-07 07:12:39 +01:00
Noel Grandin
28239c4043 simplify UNO getTypes methods
Change-Id: Ia8b07edec54527fb4904536fabb03a18e8452550
Reviewed-on: https://gerrit.libreoffice.org/68659
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-03-04 08:52:39 +01:00
Stephan Bergmann
e1e39fac22 Some more WIN32 -> _WIN32
...at least some of which have presumably been missing from
ce43d0ae92 "use consistent #define checks for the
Windows platform" by accident (and some just clean up comments)

Change-Id: I5532685c7df96ae3c8a25b73d8064d7433964a9b
Reviewed-on: https://gerrit.libreoffice.org/68580
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2019-03-01 17:40:47 +01:00
Noel Grandin
c7f5da8b04 fix comparison of std::lower_bound result
turns out using a compare operator that takes something other than the
element type as a parameter is really hard to get right.

The changes in:
    basic/source/classes/propacc.cxx
    comphelper/source/property/propagg.cxx
    vcl/source/font/font.cxx
are a regression from
    commit 35e80e9726
    Date:   Fri Oct 19 16:01:19 2018 +0200
    when calling std::lower_bound

The change in
    toolkit/source/awt/vclxtoolkit.cxx
is a regression from
    commit 76dd28afc9
    Date:   Tue Oct 9 16:27:11 2018 +0200
    loplugin:staticvar in various

Change-Id: Icf6db22e1fc091517a53dd3624913c8c2071c106
Reviewed-on: https://gerrit.libreoffice.org/67954
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-18 11:04:27 +01:00
Yusuf Sonmez
3b5dd1d49e tdf#112689: Replace chained O(U)StringBuffer::append() with operator+
Change-Id: I84fcc109087fe72cf68cf6cc1b8cf4045488ff46
Reviewed-on: https://gerrit.libreoffice.org/67601
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2019-02-11 14:33:12 +01:00
Noel Grandin
0d1253c232 new loplugin writeonlyvars
largely based on the relevant portion of the unusedfields loplugin, but
adapted for local vars

Change-Id: Ic522a941573940e8f75c88f90ba5f37508ca49b1
Reviewed-on: https://gerrit.libreoffice.org/66835
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-11 13:25:31 +01:00
Muzaffer Kadir YILMAZ
3e214676b9 tdf#112689: Replace chained O(U)StringBuffer::append() with operator+
Change-Id: Iba19864313dc5039f5ca27be3d0c68785612346a
Reviewed-on: https://gerrit.libreoffice.org/67602
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
2019-02-11 09:09:52 +01:00
Noel Grandin
587ac01f97 loplugin:indentation in basctl..bridges
Change-Id: Ie4e27466c4258c6f774a3ebb82ec3a88c28fd753
Reviewed-on: https://gerrit.libreoffice.org/67525
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-08 10:01:05 +01:00
Andrea Gelmini
53a3181968 Fix typo
Change-Id: I9b57e73303cb12e818cd761878d0c11c38f4cc3e
Reviewed-on: https://gerrit.libreoffice.org/67481
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-02-07 07:21:21 +01:00
Andrea Gelmini
af2c169b7c Fix typo
Change-Id: Iccc171ce433e38c4eea4e73dcdba76720aa78056
Reviewed-on: https://gerrit.libreoffice.org/66969
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-01-27 09:46:25 +01:00
Gabor Kelemen
e48e063254 o3tl::make_unique -> std::make_unique in basctl...bridges
Since it is now possible to use C++14, it's time to replace
the temporary solution with the standard one

Change-Id: I9a20a58c68d12656359dcaa060d8ab41f621af32
Reviewed-on: https://gerrit.libreoffice.org/66262
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-16 07:20:49 +01:00
Gabor Kelemen
6256797dac tdf#42949 Fix IWYU warnings in include/vcl/[v-x]*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I98f49765c6b74808dcbd692e0f375dd2848fcfd4
Reviewed-on: https://gerrit.libreoffice.org/65614
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-01-07 09:13:14 +01:00
Noel Grandin
30eb0839c5 loplugin:useuniqueptr in basic and framework
Change-Id: I409c9c572eb8f3d68c8a387844b43988b4ab5c32
Reviewed-on: https://gerrit.libreoffice.org/64949
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-12 07:28:49 +01:00
Noel Grandin
38187ec15b loplugin:singlevalfields extend to all static vars
Change-Id: Ic238bb5291539fd1b7e98cb4afc9b25f37e7d528
Reviewed-on: https://gerrit.libreoffice.org/64710
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-07 07:38:24 +01:00
Andrea Gelmini
ee8cba8591 Fix typos
Change-Id: Ie85b3a61ded8c6fd7a1f8c463912062669b3719b
Reviewed-on: https://gerrit.libreoffice.org/64357
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43@gmx.de>
2018-12-01 02:13:11 +01:00
Andrea Gelmini
597aeaf7a9 Fix typo
Change-Id: I028e5462e9785bac77a98d09f0bf91b4da67e477
Reviewed-on: https://gerrit.libreoffice.org/64263
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
2018-11-30 07:51:17 +01:00
Noel Grandin
21de55596c remove unnecessary "if (!empty()" checks before loops
found with
   git grep -n -A4 'if.*!.*empty' | grep -B3 -P
'(\bfor)|(\bwhile)|(\bdo)'

Change-Id: I582235b7cf977a0f9fb4099eb306fdb4a07b5334
Reviewed-on: https://gerrit.libreoffice.org/64169
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-29 07:17:37 +01:00
Matteo Casalin
94f79b3bf1 Remove unneeded cast
Change-Id: I04279faaf11bd1249bcea0d07d60facefb5186d8
2018-11-10 22:04:08 +01:00
Noel Grandin
819149fb1f loplugin:collapseif in accessibility..cui
Change-Id: I1437b493f3289b4ac97d061bd71973580571e792
Reviewed-on: https://gerrit.libreoffice.org/62933
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-06 10:28:47 +01:00
Gabor Kelemen
d90ec5d26f tdf#42949 Fix IWYU warnings in include/xmlscript/*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: Iacc5b98b947a26ca920cb9c49e579bc61d69b0c9
Reviewed-on: https://gerrit.libreoffice.org/62119
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-10-25 09:09:35 +02:00
Noel Grandin
44688e498c clang-tidy performance-unnecessary-copy-initialization in
basctl..basic

Change-Id: I4009282869cd8a2f269093564bd4fafccab80ec3
Reviewed-on: https://gerrit.libreoffice.org/62212
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-23 08:39:10 +02:00