Age | Commit message (Collapse) | Author |
|
look for OUStringBuffer append sequences that can be turned
into creating an OUString with + operations
Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6
Reviewed-on: https://gerrit.libreoffice.org/80809
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...to find matches of
... << s.getStr()
(for the rtl string classes) that can be written as just
... << s
Some notes:
* The OUStringToOString(..., RTL_TEXTENCODING_UTF8) is left explicit in
desktop/source/app/crashreport.cxx (even though that would also be done
internally by the "<< OUString" operator) to clarify that these values are
written out as UTF-8 (and not as what that operator << happens to use, which
just also happens to be UTF-8).
* OUSTRING_TO_CSTR (include/oox/helper/helper.hxx) is no longer used now.
* Just don't bother to use osl_getThreadTextEncoding() in the SAL_WARN in
lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx.
* The toUtf8() in the SAL_DEBUG in pyuno/source/module/pyuno_module.cxx can just
go, too.
Change-Id: I4602f0379ef816bff310f1e51b57c56b7e3f0136
Reviewed-on: https://gerrit.libreoffice.org/80762
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
...which was added with 8f4fdb405a8470b9d06ab14ced120da89b213e82 "New
loplugin:classmemaccess", but I forgot to include this change to
solenv/CompilerTest_compilerplugins_clang.mk in that commit
Change-Id: If1580b28369443f09dae8882346b1e0ff8214ab4
Reviewed-on: https://gerrit.libreoffice.org/80699
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
look for places where we can replace sequential additions to
OUString/OString with one concatentation (i.e. +) expression, which is
more efficient
Change-Id: I64d91328bf64828d8328b1cad9e90953c0a75663
Reviewed-on: https://gerrit.libreoffice.org/79406
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Apply the constmethod plugin, but only to accessor-type methods, e.g.
IsFoo(), GetBar(), etc, where we can be sure of that
constifying is a reasonable thing to do.
Change-Id: Ibc97f5f359a0992dd1ce2d66f0189f8a0a43d98a
Reviewed-on: https://gerrit.libreoffice.org/74269
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Something like auto str = "string" + OUString::number( 10 ); will
not be OUString but actually rtl::OUStringConcat (which gets implicitly
converted to OUString, but not with auto). Since those refer to temporaries
from the expression, they should not outlive the expression.
Change-Id: Ib4cde4b38befb3d49927d0cf01c52ebb2d36df89
Reviewed-on: https://gerrit.libreoffice.org/78830
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
|
|
Where the problem was benign and the class was not extended, I marked
the class as final.
Where the problem was benign and the class was extended, I marked the
relevant callee methods as final.
Other cases were excluded in the plugin.
Change-Id: Idb762fb2206af4e8b534aa35ff77f8368c7909bc
Reviewed-on: https://gerrit.libreoffice.org/79089
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
idea from mike kaganski
look for places where we can mark move operators as noexcept, which
makes some STL operations more efficient
Change-Id: Id732b89d1fcadd5ceb0ea2b9d159fed06136330f
Reviewed-on: https://gerrit.libreoffice.org/78251
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...finding dubious additions to namespace std (concentrating on functions for
now). C++17 [namespace.std]/1: "The behavior of a C ++ program is undefined if
it adds declarations or definitions to namespace std or to a namespace within
namespace std unless otherwise specified."
This found
ad4c7b97752b4da73808402604d6f96b39d920f5 "Avoid declaring function templates in
namespace std"
042e30a3dc057aef4a02d95960e4dd4fb8d083ae "Avoid adding a function template
declaration to namespace std"
cae9240a76cdb0eeed92421930d3b4cbef0ac201 "Avoid adding a function declaration to
namespace std"
Change-Id: Ic2ba54e2a8bf931d5c58cedf499c0d1229eb2166
Reviewed-on: https://gerrit.libreoffice.org/78220
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
look for code that thwarts copy-elision/move optimisations by
returning const values.
Change-Id: Iafa038d15051e06ee76d8a1c0ce8b7d234cd8488
Reviewed-on: https://gerrit.libreoffice.org/77964
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...<https://github.com/llvm/llvm-project/commit/
0a42fe70a566f22599e04a6f1344ca2dc5565e17> "[AST] Treat semantic form of
InitListExpr as implicit code in traversals"
Change-Id: Ifd17009fcc6933abf0e9178dbe47fb9c14b274b7
Reviewed-on: https://gerrit.libreoffice.org/77595
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
look for places we should be using std::as_const on for-range
loops over uno::Sequence, to avoid triggering a copy
Change-Id: I7efb641bf09d37c87946f03428ee4eec90298c8a
Reviewed-on: https://gerrit.libreoffice.org/77441
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: I6b5f73b2187009e95d4d666e03e5803f522cee06
Reviewed-on: https://gerrit.libreoffice.org/76584
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Improve the plugin to avoid generating false+ with the special case of
querying XInterface (what the code calls normalisation).
Also ignore places where the querying is dealing with ambiguous base
classes.
Change-Id: I23b2b2fa6618328fafc4707b94c26582a462ea87
Reviewed-on: https://gerrit.libreoffice.org/74993
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
to be used to find places to use new TOOLS_WARN_EXCEPTION,etc macros
Change-Id: I213ab47efa82075435bb800736ee0937aea0486c
Reviewed-on: https://gerrit.libreoffice.org/73950
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Inherit from tools::WeakBase non-virtually, so that we can use a
static_cast in tools::WeakReference::get instead of a dynamic_cast.
This takes the file-open time from 1m21 to 40s for me.
Add a clang plugin to make sure we don't accidentally end up inheriting
from tools::WeakBase more than once.
Change-Id: I9c7c36403333f99094e1f9d8cce2ecd9200377f9
Reviewed-on: https://gerrit.libreoffice.org/71231
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...to find more bugs like the one addressed in
6340daac7b99c65249363a4bb61c492de31ef5d6 "Revert broken
loplugin:sequentialassign change". What it does is: "Warn when a variable is
referenced from its own initializer. This is not invalid in general (see C++17
[basic.life]), but is at least suspicious." It found one false positive
(addressed with 884ad0d1af88f9985d30ef0dfe92d89e82f8e576 "Split
localProcessFactory function into class with setter and getter") and five true
positives (addressed with e0ccbe72ed6eb0d309ed272a78fd67a512acff5d "Fix use of
variable before its lifetime begins" and
0e335af4d3f044511551fa2ede20911beaee9b41 "Fix uses of variables before their
lifetimes begin").
Change-Id: I4c45cceaa042e93b37ad24a54784c027f6ca1f87
Reviewed-on: https://gerrit.libreoffice.org/70897
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Look for places we are assigning to the same variable twice
in succession, which means we can simplify that to a single assign
Change-Id: I499d20e28f5595e81e927bef8e1bf364eea8ba91
Reviewed-on: https://gerrit.libreoffice.org/70531
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
look for places we are doing code like:
Reference<XProperty>(model, css::uno::UNO_QUERY)->getAsProperty()
which might result in a SIGSEGV is the query fails
Change-Id: I5cbdbc9e64bd0bed588297c512bf60cbacb9442e
Reviewed-on: https://gerrit.libreoffice.org/69044
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
detect static variables that can be made const.
Thanks to mike kaganski for suggesting this.
Here I introduce a new plugin feature - using markers
in nearby comments to disable the plugin for specific
vars.
Some of this stuff was old debugging code. I removed the stuff
that was older than 5 years.
Change-Id: I6ec7742a7fdadf28fd128b592fcdf6da8257585c
Reviewed-on: https://gerrit.libreoffice.org/68807
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
This reverts commit c9bb48386bad7d2a40e6958883328145ae439cad,
and adds a bunch more fixes.
Change-Id: Ib584d302a73125528eba85fa1e722cb6fc41538a
Reviewed-on: https://gerrit.libreoffice.org/68680
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
This reverts commit 9865440d217d975206a3f91612f0666312bc8fd8.
This is not ready to land yet, seems like the latest update
of the logic reveals a bunch more places I need to fix before it can land.
|
|
verify that parameters use the exact same typedef-names (if any)
in definition and declaration
Change-Id: I55d2817f599b0253904dce2d35a1a93967e15a77
Reviewed-on: https://gerrit.libreoffice.org/68439
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: Ib8adefd90141007c0422b4c15ba9c2cc5f707f3f
Reviewed-on: https://gerrit.libreoffice.org/67762
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
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>
|
|
look for mixed indentation in compound statements, which makes them hard
to read, and sometimes makes it look like a statement is associated with
a nearby if/for
Change-Id: Ic8429cee1f9a86d938097a4a8769a2bce97b3361
Reviewed-on: https://gerrit.libreoffice.org/63283
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
when dealing with modifications to container classes (e.g. std::vector)
Change-Id: Ic30043631007355ee9a3d9e3f9b6488b435182d6
Reviewed-on: https://gerrit.libreoffice.org/65050
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: Ifdf1a152f6bc2e2f6edae97a5191120f630f7e49
Reviewed-on: https://gerrit.libreoffice.org/64374
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
add some unit tests, and improve the heuristics
Change-Id: I95aa97a87e178ce8d506bd245710d0ae66ad08a4
Reviewed-on: https://gerrit.libreoffice.org/63647
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...(ExprWithCleanups around the CXXConstructExpr in initializers for members of
O[U]String type, with older Clang, as used in
compilerplugins/clang/test/staticconstfield.cxx), and thus revert
e3e8d52625c2dc7a277a955d4ae2ad10c60c5f1b "Temporarily disable
compilerplugins/clang/test/staticconstfield" again.
Change-Id: Ic5fcdd1a26e4a6810369e4f9d909200d25feb12e
Reviewed-on: https://gerrit.libreoffice.org/63628
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
Of the "Gerrit Linux clang/dbgutil" build nodes, one (tb79-pollux) has done the
lode update to use Clang 3.9.1, while the other two nodes (tb75-lilith and
tb76-maggie) are still at the old Clang 3.8.0. When building Gerrit changes for
master, tb79-pollux started to fail in
compilerplugins/clang/test/staticconstfield now
(<https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/20247/> and
<https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/20252/>) while such
builds on the other two nodes still succeed. So it looks like Clang 3.9.1 has
some issue with that loplugin, which will need further inspection. For now, to
not break Gerrit/Jenkins builds, disable that test.
Change-Id: I1bd380fb98d3b9a411dd04578a5620cdb27cd35b
|
|
Change-Id: If6dd8033daf2103a81c3a7c3a44cf1e38d0a3744
Reviewed-on: https://gerrit.libreoffice.org/63466
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
checking for casting to void* turns out to mask useful stuff, so
remove that and just deal with a few extra false+
Change-Id: Id9700d7ceda90ba8fdb38aa870f13a7ca3acb668
Reviewed-on: https://gerrit.libreoffice.org/63145
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Look for nested if statements with relatively small conditions, where
they can be collapsed into one if statement.
Change-Id: I7d5d4e418d0ce928991a3308fc88969c00c0d0f2
Reviewed-on: https://gerrit.libreoffice.org/62898
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
looks for variables that can be declared const and static i.e. they can
be stored in the read-only linker segment and shared between different
processes
Change-Id: I577fb2070604003e56fb44f8a02c9684070311cf
Reviewed-on: https://gerrit.libreoffice.org/61817
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...because loplugin:constfields is wrapped in
#if !defined _WIN32 //TODO, #include <sys/file.h>
Change-Id: I9b2a72ecd31f561c71be5a74a752344c24d40f26
Reviewed-on: https://gerrit.libreoffice.org/60598
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
in preparation for making it more general
Change-Id: I2fc8d0f99140dc7ef72341f8cbf28d6536ebd61f
Reviewed-on: https://gerrit.libreoffice.org/60525
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
no need to init smart pointers with nullptr, they all have default
constructors that do this already
Change-Id: Ief20c060daa0def8c1aa82f1cf8dc4bc696761e9
Reviewed-on: https://gerrit.libreoffice.org/59818
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
look for fields which are only assigned to in the constructor, so they
can be made const
Change-Id: I0b76817c2181227b04f6a29d6a808f5e31999765
Reviewed-on: https://gerrit.libreoffice.org/60393
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
look for places where we are appending the temporary result of adding
strings together, to an OUStringBuffer, where we could rather call
append repeatedly and avoid the temporary creation
Change-Id: I481435124291ac7fb54b91a78344a9fe5b379a82
Reviewed-on: https://gerrit.libreoffice.org/59708
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Look for const string fields which can be static, and
mostly convert them to OUStringLiteral
And add a getLength() method to OUStringLiteral to make
the transition easier.
Remove dead code in XclExpRoot::GenerateDefaultEncryptionData,
default password is never empty.
Change-Id: Iae75514d9dbb87289fd5b016222f640abe755091
Reviewed-on: https://gerrit.libreoffice.org/59204
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
look for OUString being appended to in a loop, better to use
OUStringBuffer to accumulate the results.
Change-Id: Ia36e06e2781a7c546ce9cbad62727aa4c5f10c4b
Reviewed-on: https://gerrit.libreoffice.org/58092
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
look for methods returning only 1 and/or 0, which (most of the time)
should be returning bool.
Off by default, because some of this is a matter of taste
Change-Id: Ib17782e629888255196e89d4a178618a9612a0de
Reviewed-on: https://gerrit.libreoffice.org/54379
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
...to avoid a false positive in --enable-qt5
> [build CXX] vcl/qt5/Qt5Widget.cxx
> /home/sbergman/lo/core/vcl/qt5/Qt5Widget.cxx:466:21: error: Unreferenced function declaration [loplugin:unreffun]
> friend QWidget* createQt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f);
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
Change-Id: I01e47bc5f5147916737d62fe18ce5312a0221a3f
Reviewed-on: https://gerrit.libreoffice.org/55189
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
|
|
collection of heuristics to look for local variables that are never read
from i.e. do not contribute to the surrounding logic
This is an expensive plugin, since it walks up the parent tree,
so it is off by default.
Change-Id: Ib8ba292241bd16adf299e8bba4502cb473513a06
Reviewed-on: https://gerrit.libreoffice.org/52450
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
enforce that DBG_UNHANDLED_EXCEPTION is called first in a catch block,
otherwise it cannot do it's job properly
Change-Id: I906436c6861212c44f8f21552ccbceb54f15c6e1
Reviewed-on: https://gerrit.libreoffice.org/52303
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
and rename it to DBG_UNHANDLED_EXCEPTION, to make it more like
the SAL_WARN-type macros.
Use some macro magic to deal with different numbers of arguments.
Update the sallogareas plugin to check the area parameter of
DBG_UNHANDLED_EXCEPTION.
Change-Id: Ie790223244c3484f41acb3679c043fb9b438e7c4
Reviewed-on: https://gerrit.libreoffice.org/52073
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: Ib8f2ef485f548645c4b0e7cf080b72b28c4e278d
Reviewed-on: https://gerrit.libreoffice.org/50226
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
|
|
Change-Id: I34e28a30a4f1fd264c18c901cd94094531543271
|
|
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>
|