764 Commits

Author SHA1 Message Date
Stephan Bergmann
75f0f9d553 New loplugin:faileddyncast
Offline discussion about tdf#96067 "Crash on undo row inserts" brought up the
idea to warn about cases where uses of dynamic_cast are statically knwon to
always fail.  Clang's clang::AST::CXXDynamicCastExpr::isAlwaysNull already
implements such a check, reporting true if the casted-from class is final, but
has two issues:

For one, it does not work for template code, when one of the involved types is a
template parameter type (so e.g., DestType->castAs<PointerType>() can crash).

For another, it misses the opportunity to report true if the casted-to type is
final and only derives from the casted-from type non-publicly.  My hope was that
this, after the "final" decorations in 548c43238d02b34cf73e7c2ca1a912ee4fe82544
"Mark some classes as final," might turn up the culprit of tdf#96067 (with a
scenario similar to the failed dynamic_cast on private derivation in
63b67ab5cab8cf7576a68cabe5fb1a42c6ad800c "Use public derivation, and remove
then-unnecessary downcasts")---but not so.

Change-Id: I962ee19820758f9c601f4a292da7f37fa9dff5ce
2016-01-12 15:00:33 +01:00
Noel Grandin
1f9a610de1 loplugin:unusedmethods unused return value in include/editeng
Change-Id: I1314480950b0d3a3e5ed066d71c175604dd41970
Reviewed-on: https://gerrit.libreoffice.org/21361
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-12 07:39:42 +00:00
Stephan Bergmann
67ec72a381 New loplugin:privatebase
...to flag places that implicitly derive a class privately instead of publicly,
where accidental private derivation can cause unexpected failure of
dynamic_cast, cf. 63b67ab5cab8cf7576a68cabe5fb1a42c6ad800c "Use public
derivation, and remove then-unnecessary downcasts."

Change-Id: I4bcd5c79c7e27380c820e2dd072fa4c4e8980078
2016-01-11 13:17:10 +01:00
Noel Grandin
a3f3cead5d loplugin: unused return values in desktop
Change-Id: Iec7a150c6bdb3b25fe24d711e3e453e1d8a5d26e
2016-01-11 11:59:18 +02:00
Noel Grandin
86bb6fdf9c update unusedmethods loplugin to update unused return values
Change-Id: I825d022d09282bc9b6cffd9178e40e4090d335da
2016-01-11 10:49:24 +02:00
Andrea Gelmini
64d624b651 Fix typos
Change-Id: I9a5940027423ff0791fa7da0b79b617412ce6b86
Reviewed-on: https://gerrit.libreoffice.org/21209
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-10 14:17:20 +00:00
Andrea Gelmini
597e694e7e Fix typos
Change-Id: I90b04b8eda6fc3d530c9db72052720cbe9de0343
Reviewed-on: https://gerrit.libreoffice.org/21197
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2016-01-07 12:29:04 +00:00
Stephan Bergmann
6bffbf100e Enable loplugin:nullptr
I had it locally enabled for like a month now, and it did not produce any more
noise than any of the other plugins.

Change-Id: I94dab702c537969cf32922f6e88b4f5b503cd3f5
2016-01-06 16:48:15 +01:00
Stephan Bergmann
593f3b703c Re-enable loplugin:sallogareas
I had it locally enabled for like a month now, and it did not produce any more
noise than any of the other plugins, but quite some amount of malformed area
designators had been introduced over time.

Change-Id: I642591496bb9338246ba43a3d988481930c087fb
2016-01-06 16:48:15 +01:00
Andrzej Hunt
9d0b06e9f7 new loplugin rangedforcopy - use reference in range based for
Inspired by 6e6ae9803796b120e95f6e89575e03c5fd0ed3c2

Change-Id: Ia0f264d3a6bbf076aa5080e3398683e50bc6ef01
Reviewed-on: https://gerrit.libreoffice.org/20190
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2016-01-05 11:06:52 +00:00
Stephan Bergmann
f44bd6b054 Adapt loplugin:implicitboolconversion to changes in Clang trunk towards 3.8
Change-Id: I7841eee5b66a118c52258c0226d73a1139a0df9a
2016-01-05 09:51:29 +01:00
Miklos Vajna
29aec38789 compilerplugins: avoid std::regex_replace
My clang 3.7 built against libstdc++ 5.2.1 doesn't seem to have it. We
can get away with a non-regex replace all here, though.

Change-Id: Iea36311d89acb434c4e4f7c1f9ce876a6ee84f42
2015-12-21 17:31:01 +01:00
Noel Grandin
e18b08363a loplugin:unusedmethods
Change-Id: Ifafdaf6da0225f244853a0042a6458643b570623
2015-12-21 10:20:31 +02:00
Noel Grandin
00ea9e5e4e update constantfunction loplugin
Change-Id: I7917e5e17e88868a5e315bce11099d32a07ca39e
2015-12-15 10:40:50 +02:00
Jan Holesovsky
007543f967 sc: Merge ScMultiTextWnd into ScTextWnd.
Change-Id: I21ed0e37feec0e7c078c2e284b7f4169f0cff432
2015-12-11 10:43:00 +01:00
Stephan Bergmann
4a1edf626a More loplugin:nullptr automatic rewrite (within templates)
Change-Id: I9bc06cfb5eeb38fd7ae7fb25f876ea9f96e4a65a
2015-12-10 17:34:31 +01:00
Stephan Bergmann
fb8a3fac5d loplugin:nullptr: More NULL -> nullptr automatic rewrite
Change-Id: Ie83819e2bcdc5fa160b39296b005ca9a5ff74b1d
2015-12-10 08:06:06 +01:00
Stephan Bergmann
6fd3f3caad Missing new file
Change-Id: Ie47ffb36f17882da8a78036f7797b2e2bac78eb6
2015-12-09 00:01:47 +01:00
Stephan Bergmann
bb24492c76 More loplugin::TypeCheck use
Change-Id: I2f4a26a918134568f541cd45bdcf5a12b1f1d2ee
2015-12-08 22:56:02 +01:00
Jan Holesovsky
4c4999d944 tdf#96042: 'std::string::find("something") == 0' means "startsWith()".
This should fix a regression from 3bdd176731c351638f541a37b94094124f3c9f52,
apparently the cppcheck's advice is misleading.

Change-Id: I427ecaa1eb3c9841cb6112997b9b51feda4583d0
2015-12-08 12:12:53 +01:00
Stephan Bergmann
b0e427d8aa Remove apparently unnecessary checks
...they don't cause any change in behavior, likely they predated Noel's figuring
out the template part of containsWindowSubclass

Change-Id: I0d5b6bd7f228acef9a0ce1c85fe98fbab89bd7a8
2015-12-08 09:44:34 +01:00
Stephan Bergmann
2e43a10949 No, "rtl::Reference<VclStatusListener<Button>> mpStatusListener;" is fine
...as a member of ImplCommandButtonData (vcl/source/control/button.cxx), no need
to falsly warn "OutputDevice subclass 'rtl::Reference<VclStatusListener<Button>>'
declared as a pointer member, should be wrapped in VclPtr [loplugin:vclwidgets]"

Probably loplugin:vclwidgets should enable shouldVisitTemplateInstantiations()
and not try to second-guess whether an OutputDevice can be a template argument.

Change-Id: Ia8feb1b1d7504941c35dfbf0aa02dc6a7dd818a0
2015-12-07 17:12:39 +01:00
Noel Grandin
7e1bb64f14 loplugin:mergeclasses OOXMLPropertyImpl into OOXMLProperty
Change-Id: I1447cfc76c529332450c90a21b6525d3103fe852
2015-12-07 11:01:59 +02:00
Noel Grandin
9f0f30fa35 loplugin:mergeclasses, merge OOXMLPropertyImpl into OOXMLProperty
Change-Id: I73eb7e664c0a53f135c06c3d8ea450bd9493c780
2015-12-07 11:01:58 +02:00
Stephan Bergmann
0e54605e61 loplugin:stringconcat: Also look through O[U]String ctors
Change-Id: I4f07c7c61d324a85f9f5dee0f25a7358facebd41
2015-12-02 14:01:56 +01:00
Stephan Bergmann
f540e9264c loplugin:stringconcat: Handle base case of recursion into left arg
Change-Id: I9ed8586e8b77b009d55e411fdaa863eefc38b1c2
2015-12-02 14:01:55 +01:00
Noel Grandin
ec3f724158 loplugin:unusedfields
Change-Id: Icac4ac1a2614e72bc9ff070819533e09eeb1a864
2015-11-30 10:34:38 +02:00
Noel Grandin
25120e73f9 loplugin:mergeclasses, OOXMLTableImpl into OOXMLTable
Change-Id: I28f6d317ca02cf23341358f9520de273af603bd7
2015-11-30 10:04:03 +02:00
Noel Grandin
abc6071b7a loplugin:unusedfields various
Change-Id: I18f94269a1172cf195ee402384f7144610e1e82d
2015-11-26 13:26:25 +02:00
Miklos Vajna
16677bbdb8 compilerplugins: adapt comment
...after 49c2b9808df8a6b197dec666dfc0cda6321a4306
"bin/rename-sw-abbreviations.sh"

Change-Id: Ibd74246403bead8100d181b335f9145013f31e5e
2015-11-26 10:18:52 +01:00
Stephan Bergmann
8830956414 Adapt whitelisted names
...after 49c2b9808df8a6b197dec666dfc0cda6321a4306
"bin/rename-sw-abbreviations.sh"

Change-Id: I90cec551bdc52ea4d76dd9e32b45692e8a3be70f
2015-11-26 09:58:15 +01:00
Noel Grandin
1f86864e97 loplugin:unusedfields various
Change-Id: I59d9f7f73677358b4ae57efda965d43718bdf0d5
2015-11-25 13:57:29 +02:00
Noel Grandin
234884c09d loplugin:unusedfields in include/sot,include/svl,include/svtools
Change-Id: Ia2dd13c2c48b127ab85311a668fa1f37608d360a
2015-11-25 08:25:09 +02:00
Noel Grandin
f273676325 update unusedfields plugin to use new clang warn_unused attribute support
Change-Id: I7b84de29b672e40cbf3c3d340d235f334d2be8cb
2015-11-24 11:04:33 +02:00
Noel Grandin
dd351dd728 loplugin:unusedfields in vcl/
and remove the unused SALEVENT_MOUSEACTIVATE stuff

Change-Id: Ieb85872eca68621c6a7be47ff5dbea12f7690507
Reviewed-on: https://gerrit.libreoffice.org/20140
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-11-24 08:17:55 +00:00
Noel Grandin
acc4acb9ca loplugin:unusedfields in tools/
Change-Id: Ic460bf42cbcf356cdcebbd5060a0dad3d3caa4ef
2015-11-24 08:09:24 +02:00
Noel Grandin
8770cd3894 loplugin:unusedfields in sw/
Change-Id: I323a038e5581b00cd3a4ea2f362c66540377759e
2015-11-24 08:05:02 +02:00
Noel Grandin
05eda0dc19 loplugin:unusedfields in sc
Change-Id: If5123e676a27302f3e11475309bc748977c6f430
2015-11-23 08:55:53 +02:00
Noel Grandin
3aff028b8f loplugin:unusedfields in dbaccess
Change-Id: I563c3727c1719fe21acced269e5469c2de7112e8
2015-11-20 14:06:49 +02:00
Noel Grandin
ad278c2b3a loplugin:unusedfields in basctl
and improve the plugin to search for only WARN_UNUSED and fundamental
types

Change-Id: Ic06207758e28d44d64d76d8119fd76b5b098bb05
2015-11-20 11:48:48 +02:00
Noel Grandin
1d5c39192e new loplugin:unusedfields
run it over the framework module

Change-Id: I1220a4be0936ba30136ce22ffd78633c8a7b9d35
2015-11-20 10:12:58 +02:00
Stephan Bergmann
b0339005b8 loplugin:sallogareas
Change-Id: I2220ab194384fb397716bf3227d38716ba54f537
2015-11-19 16:05:35 +01:00
Stephan Bergmann
526bbbbd2f isLookupContext already available in Clang 3.7.0
Change-Id: Ia17a116b1f7605b5a8d572c6a6f4ef64adea8f94
2015-11-19 10:12:17 +01:00
Stephan Bergmann
4a6268f0d3 Adapt compilerplugins to old Clang versions
Change-Id: I91335f1e81e251f0578792517dded9fae239fb61
2015-11-19 09:19:30 +01:00
Michael Stahl
526bfba0a0 vcl, sd: rename some overly generic static variables
Change-Id: I89159df36361f9ceff3401ef379c8230465617b7
2015-11-17 23:49:50 +01:00
Stephan Bergmann
6e6c095187 Fix check for std::weak_ptr (that may be in an inline namespace)
Change-Id: I048aef08df43d07544aafc69b711d258dc40bc21
2015-11-17 21:50:45 +01:00
Stephan Bergmann
27b45cc23c Work around loplguins:badstatics
Change-Id: I597dbc3e4288acb5b71f7a344ae78ba568451614
2015-11-17 21:31:46 +01:00
Stephan Bergmann
60c51ac007 Work around loplguins:badstatics
Change-Id: I9d8d0f6cc001de09d8d3f96d8ad7e243e07f426d
2015-11-17 19:38:41 +01:00
Stephan Bergmann
b0526e291d Work around loplguins:badstatics
Change-Id: I243dcb86cc1a99550b26962daf47c19eb62aa8df
2015-11-17 16:41:40 +01:00
Stephan Bergmann
b45aef86fa Improve comment
Change-Id: I25931d59fc1b4feb1fd1eaa036a64a28a269f409
2015-11-17 16:28:33 +01:00