Commit Graph

72 Commits

Author SHA1 Message Date
Noel Grandin
1f2ff4a0a3 loplugin:redundantcast small improvement
Change-Id: I2c96b367138b94d6178a3c4a0f83049f13a04f82
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154679
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-07-21 11:05:05 +02:00
Stephan Bergmann
7255d21f81 Fix loplugin:redundantcast check for same-type dynamic_cast
...when the target type is a reference type and the source and target type have
different cv qualifiers.  (And fix the fallout.  And make the tests cover that
somewhat more exhaustively; and while at it also test that the plugin can cope
with dynamic_cast to void pointers, which is the only legitimate case where a
dynamic_cast can involve types that are not (pointers or references to)
non-class types.)

Change-Id: Ia568ddb5dbc4a84c275db172791c345d95964857
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143133
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-11-23 08:48:46 +01:00
Noel Grandin
6bde58fa51 loplugin:redundantcast look for redundant dynamic_cast<T&>
Change-Id: If5a8e74b7ede80b782b584b4f62ec1b8713fd86d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141445
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-10-17 12:00:28 +02:00
Stephan Bergmann
70f8bddf87 Extend loplugin:redundantcast to some suspicious reinterpret_cast
Change-Id: I5534939bfbea67d216a17891722a683c53621d36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140303
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-09-21 15:09:26 +02:00
Stephan Bergmann
905559f3f4 Adapt to Clang 15 trunk increase in ElabortatedType sugar
...<bdc6974f92>
"[clang] Implement ElaboratedType sugaring for types written bare".

For one, it caused diagnostics to now emit 'OString' instead of 'rtl::OUString'
etc., which required adapting a number of tests.

For another, some tests started to fail because the relevant plugins didn't
expect ElaboratedType sugar in places where it now occurs:

> error: 'error' diagnostics expected but not seen:
>   File compilerplugins/clang/test/redundantcast.cxx Line 297: redundant cstyle cast from 'Enum1' to 'Enum1' [loplugin:redundantcast]
>   File compilerplugins/clang/test/redundantcast.cxx Line 308: redundant cstyle cast from 'Enum1' to 'Enum1' [loplugin:redundantcast]

> error: 'error' diagnostics expected but not seen:
>   File compilerplugins/clang/test/referencecasting.cxx Line 25 (directive at compilerplugins/clang/test/referencecasting.cxx:24): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]
>   File compilerplugins/clang/test/referencecasting.cxx Line 37 (directive at compilerplugins/clang/test/referencecasting.cxx:36): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]
>   File compilerplugins/clang/test/referencecasting.cxx Line 48 (directive at compilerplugins/clang/test/referencecasting.cxx:47): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]
>   File compilerplugins/clang/test/referencecasting.cxx Line 100 (directive at compilerplugins/clang/test/referencecasting.cxx:99): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]
>   File compilerplugins/clang/test/referencecasting.cxx Line 120 (directive at compilerplugins/clang/test/referencecasting.cxx:119): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]
>   File compilerplugins/clang/test/referencecasting.cxx Line 188 (directive at compilerplugins/clang/test/referencecasting.cxx:187): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]
>   File compilerplugins/clang/test/referencecasting.cxx Line 200 (directive at compilerplugins/clang/test/referencecasting.cxx:199): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]
>   File compilerplugins/clang/test/referencecasting.cxx Line 206 (directive at compilerplugins/clang/test/referencecasting.cxx:205): the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]

> error: 'error' diagnostics seen but not expected:
>   File compilerplugins/clang/test/typedefparam.cxx Line 42: function param 1 at definition site does not match function param at declaration site, 'FooT *' (aka 'test2::Foo *') vs 'struct Foo *' [loplugin:typedefparam]
>   File compilerplugins/clang/test/typedefparam.cxx Line 55: function param 1 at definition site does not match function param at declaration site, 'FooT *' (aka 'test3::Foo *') vs 'Foo *' [loplugin:typedefparam]
> error: 'note' diagnostics seen but not expected:
>   File compilerplugins/clang/test/typedefparam.cxx Line 40: declaration site here [loplugin:typedefparam]
>   File compilerplugins/clang/test/typedefparam.cxx Line 53: declaration site here [loplugin:typedefparam]

Hopefully, there are not too many places in our plugins left that similarly
don't expect ElaboratedType sugar in certain places, but which are not covered
by tests.  At least, a full build didn't turn up any further false positives,
but there may of course be false negatives now that would go undetected.

Change-Id: I9bfb1cfb57df5f6e228b512c19c664d48285b675
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137049
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-07-14 14:04:09 +02:00
Stephan Bergmann
41a967af06 Extend loplugin:redundantcast to trivial reinterpret_cast from T to itself
Change-Id: I7c0be7b435d6b5f97bdd40484023584146638d70
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134506
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-05-18 10:52:59 +02:00
Stephan Bergmann
d1a2b80b9d Bump compiler plugins Clang baseline to 12.0.1
...as discussed in the mail thread starting at
<https://lists.freedesktop.org/archives/libreoffice/2020-November/086234.html>
"Bump --enable-compiler-plugins Clang baseline?" (and now picked up again at
<https://lists.freedesktop.org/archives/libreoffice/2022-February/088459.html>
"Re: Bump --enable-compiler-plugins Clang baseline?"), and clean up
compilerplugins/clang/ accordingly

Change-Id: I5e81c6fdcc363aeefd6227606225b526fdf7ac16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129989
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2022-02-17 21:45:06 +01:00
Stephan Bergmann
21da7d80aa Adapt o3tl::temporary to C++23 P2266R1
With the recent implemenation of
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2266r1.html> "P2266R1:
Simpler implicit move" in Clang 13 trunk as
<bf20631782>
"[clang] Implement P2266 Simpler implicit move", a --with-latest-c++ build
started to fail with

> In file included from sal/rtl/random.cxx:25:
> include/o3tl/temporary.hxx:21:62: error: non-const lvalue reference to type 'double' cannot bind to a temporary of type 'double'
> template <typename T> constexpr T& temporary(T&& x) { return x; }
>                                                              ^
> sal/rtl/random.cxx:97:37: note: in instantiation of function template specialization 'o3tl::temporary<double>' requested here
>     return std::modf(random, &o3tl::temporary(double()));
>                                     ^

etc.  (And fixing that by adding the recommended static_cast then triggered a
false loplugin:redundantcast warning.)

Change-Id: I222429e9872afdedf77a07014c0a2e9e06c60b50
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117335
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-17 14:16:59 +02:00
Stephan Bergmann
3732bba5e2 Adapt compilerplugins to Clang VK_RValue -> VK_PRValue rename
<aef5d8fdc7>
"[clang] NFC: Rename rvalue to prvalue"

Change-Id: I237e8a491465500e35637f8dae400402bcd9411d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116983
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-06-10 15:42:45 +02:00
Noel
068d4108e5 loplugin:redundantcast catch more dynamic_cast
Change-Id: Ia28e58217cefa306567b53688d851fa210b7821c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110287
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-02 12:24:00 +01:00
Stephan Bergmann
5d546de67b Adapt to Clang 12 trunk RecursiveASTVisitor change
<https://github.com/llvm/llvm-project/commit/
5689b38c6a4220cc5f6ba68a56486229b10071bf> "Removed a RecursiveASTVisitor feature
to visit operator kinds with different methods".

That change is incompatible in that before the change individual TraverseUnary*
and TraverseBin* functions were called, while now TraverseUnaryOperator and
TraverseBinaryOperator/TraverseCompoundAssignOperator are called for all the
different operators.  Fixed that with a few #if for the non-shared plugins, but
that doesn't work for the shared plugin.  So made the two affected plugins non-
shared for now and left a better fix as a TODO.

Change-Id: I5b87d329ae2c4c93bf605bb1ecc9641039f014a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99000
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-19 23:05:57 +02:00
Stephan Bergmann
a0b220b3a6 Avoid loplugin:redundantcast from within qWarning macro
...as seen with qt5-qtbase-devel-5.13.2-1.fc31.x86_64:

> vcl/unx/gtk3_kde5/kde5_filepicker_ipc.cxx:367:5: error: redundant static_cast from 'const char [65]' to 'const char *' [loplugin:redundantcast]
>     qWarning() << "unhandled command " << static_cast<uint16_t>(command);
>     ^~~~~~~~
> /usr/include/qt5/QtCore/qlogging.h:167:33: note: expanded from macro 'qWarning'
> #define qWarning QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).warning
>                                 ^~~~~~~~~~~~~~~~~~
> /usr/include/qt5/QtCore/qlogging.h:156:30: note: expanded from macro 'QT_MESSAGELOG_FILE'
>   #define QT_MESSAGELOG_FILE static_cast<const char *>(__FILE__)
>                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: I9578b07cfd1a2de570ae2ab5842d65ef708f5d6a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86802
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-14 21:41:23 +01:00
Stephan Bergmann
75bbbfc6bd loplugin:redundantcast: Don't warn about cast from nullptr_t to function ptr
See comments at <https://gerrit.libreoffice.org/#/c/81958/> "Only initialize
function pointer once" for a case where such a false warning caused trouble (in
a lambda with deduced return type and multiple return statements).

Change-Id: I64b0b8c45bd3d2a6075e336c361ec778fa0da481
Reviewed-on: https://gerrit.libreoffice.org/82034
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-11-04 17:20:28 +01:00
Noel Grandin
9e0b3423f2 loplugin:referencecasting find more redundant static_cast
Change-Id: I3a51812bbd3fcdc6b11e47cb12962f0d4fa7a2ae
Reviewed-on: https://gerrit.libreoffice.org/78191
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-08-27 18:42:13 +02:00
Stephan Bergmann
50e644253f Take array-to-pointer decay into account in loplugin:redundantcast
Change-Id: I3c5bace180605d1a72a74feb1bf9f9b184a16d83
Reviewed-on: https://gerrit.libreoffice.org/63545
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-11-19 09:25:35 +01:00
Noel Grandin
9f4d23c151 filter out some of the AST in the plugins
by checking if the current namespace decl is in our code, so we have to
scan less stuff, which results in a 10% perf improvement for me

Change-Id: Idf0e30d57b6d0dcd13daa9ed679c28b9d233d387
Reviewed-on: https://gerrit.libreoffice.org/58942
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-08-14 13:02:14 +02:00
Stephan Bergmann
3cc5149a84 Avoid -Werror=deprecated-declarations with recent Clang trunk
...which first added alternative names to and then deprecated getLocBegin/End

Change-Id: Iaefb8ce259057abfa6cd20f0b63c0ef2949a96b2
Reviewed-on: https://gerrit.libreoffice.org/58820
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-10 15:14:03 +02:00
Stephan Bergmann
ae39b1ef2d Further loplugin:redundantcast improvements for floating-integer conversions
The code in svx/source/customshapes/EnhancedCustomShape2d.cxx started out as

> aStart.X() = (sal_Int32)( ( (double)( aStart.X() - aCenter.X() ) / fXScale ) ) + aCenter.X();
> aStart.Y() = (sal_Int32)( ( (double)( aStart.Y() - aCenter.Y() ) / fYScale ) ) + aCenter.Y();
> aEnd.X() = (sal_Int32)( ( (double)( aEnd.X() - aCenter.X() ) / fXScale ) ) + aCenter.X();
> aEnd.Y() = (sal_Int32)( ( (double)( aEnd.Y() - aCenter.Y() ) / fYScale ) ) + aCenter.Y();

in afd1cf255d "INTEGRATION: CWS sj05", then the
floating-point scaling factors got gradually removed first with
101559f880 "INTEGRATION: CWS bm3" and then
completely with d9f21c90bd "Fixes Circular arrow
distortion, Bug #46272".

Change-Id: I337d7893e513738c986d0e85efabcbf7bab912e5
Reviewed-on: https://gerrit.libreoffice.org/54434
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2018-05-17 08:23:37 +02:00
Stephan Bergmann
7ab34b51f2 loplugin:redundantcast improvements for floating-integer conversions
Change-Id: I63dbf18f144a792ae775fe6706da81657f790016
Reviewed-on: https://gerrit.libreoffice.org/54416
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2018-05-17 08:22:14 +02:00
Stephan Bergmann
8789f4f65b Check isOkToRemoveArithmeticCast in loplugin:redundantfcast too
...to avoid warnings like

> C:/lo64/core/svx/source/table/accessiblecell.cxx(400,12):  error: redundant functional cast from 'long' to 'sal_Int32' (aka 'long') [loplugin:redundantfcast]
>     return sal_Int32(0x0ffffffL);
>            ^~~~~~~~~~~~~~~~~~~~~

with clang-cl

Change-Id: I4a48a9f10ad75f76a3c6ab6152ab279df9a3fbcc
Reviewed-on: https://gerrit.libreoffice.org/51780
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-03-23 16:11:49 +01:00
Stephan Bergmann
9663341f92 Bump --enable-compiler-plugins to Clang 3.8.0
<https://lists.freedesktop.org/archives/libreoffice/2017-December/079107.html>
"Clang baseline bump"

Change-Id: I18fca8794ea34118fc6308458064d0c28cf5caf7
Reviewed-on: https://gerrit.libreoffice.org/46557
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-19 22:08:38 +01:00
Stephan Bergmann
306ddfb1b8 Replace deprecated std::mem_fun et al in reportdesign
(as std::mem_fun is gone by default at least from recent libc++ in C++17 mode)

Change-Id: Ib66134bd4072dfe0ce3bc36aa684cee710921235
Reviewed-on: https://gerrit.libreoffice.org/45868
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-12-05 18:11:15 +01:00
Stephan Bergmann
b35bb38f18 Clean away temporarily added using declarations
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-11-07 11:50:47 +01:00
Stephan Bergmann
5807952ef7 loplugin:redundantcast: Do warn about convoluted dynamic_cast to self
...that the compiler is free to elide anyway.  (See
4e7ffc0a69 "Avoid compiler eliding#redundant
dynamic_cast" and 380d6afe5f "Remove redundant
asserts involving dynamic_cast".)

Change-Id: I3f75154fee3e978b7ba95a5a27589417065599bd
2017-10-22 11:57:44 +02:00
Noel Grandin
ead920a48a loplugin:redundantcast handle dynamic_cast
Change-Id: I7855c76e820efce96778b1c19ec71dffcc4b4abb
Reviewed-on: https://gerrit.libreoffice.org/43621
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-21 15:44:11 +02:00
Stephan Bergmann
d883e3556a loplugin:redundantcast: cstyle_cast within reinterpret_cast
Change-Id: Ie31c9dd6d8741aa856553b798bb5b7f695a3fe0f
Reviewed-on: https://gerrit.libreoffice.org/42776
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-26 10:01:54 +02:00
Stephan Bergmann
7282b25f22 Fix loplugin:redundantcast's VisitCXXFunctionalCastExpr
...when t1 is ElaboratedType sugar (which isn't only used when the type is
written with an elaborated type keyword, but also when it is written with a
qualified name).

(I originally wrote testArithmeticTypedefs to track down a different issue,
which turned out to be a non-issue, with this fix as fall-out.  So that test
doesn't quite match the theme of this commit, but is a worthwhile addition
nonetheless.)

Change-Id: Ic447da4399853d7d045e3e2e7ade8ddf52d89749
2017-09-15 18:50:45 +02:00
Noel Grandin
5685ee25aa improve redundantcast loplugin
to find c-style casts where the expression is a templated method

Change-Id: Ifbd1e2cdc72d906fc95a7ec0f9408c3f6d2a836b
Reviewed-on: https://gerrit.libreoffice.org/42275
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-09-14 14:43:43 +02:00
Stephan Bergmann
c5616014bb loplugin:redundantcast: suppress warnings in reworked glibc assert macro
Change-Id: I20be230b3ff5d11395f33a9896d0a575c3051fb7
2017-08-25 20:21:25 +02:00
Stephan Bergmann
d7a9abdce5 Report full type info (plus the desugared type as "aka")
Change-Id: I647b1c3e479e0be01ed7ea16e1ad3dd9bed9ba6a
2017-08-18 10:23:42 +02:00
Noel Grandin
3281628e1c loplugin:redundantcast ignore functional casts involving typedefs
<sberg> noelgrandin, 718cdd43c2 now also
looks through typedef sugar, e.g. complaining about a gdouble -> double
expl. conversion in configmgr/source/dconf.cxx;
I think we want to remain silent about such conversions involving typedefs
<noelgrandin> sberg, ah, good point.

Change-Id: Icbb0d6be273f53e507c91556cf0ccb5a5c03e5a1
Reviewed-on: https://gerrit.libreoffice.org/41175
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-15 15:45:34 +02:00
Noel Grandin
718cdd43c2 loplugin:redundantcast, find more functional casts
In the enum types that caused the problem look like this when I dump
then:

EnumType 0xdb45770 'enum SvxFrameDirection'
`-Enum 0xdb456d8 'SvxFrameDirection'

SubstTemplateTypeParmType 0xdb61200 'enum SvxFrameDirection' sugar
|-TemplateTypeParmType 0xd7518f0 'EnumT' dependent depth 0 index 0
| `-TemplateTypeParm 0xd7518a8 'EnumT'
`-EnumType 0xdb45770 'enum SvxFrameDirection'
  `-Enum 0xdb456d8 'SvxFrameDirection'

Change-Id: Id8fedabe43b7a27df61a2320a9acbf54d2dc7882
Reviewed-on: https://gerrit.libreoffice.org/41169
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-08-15 13:46:29 +02:00
Stephan Bergmann
0f84a32f5b Improved loplugin:redundantcast, const/static_cast combinations
Change-Id: I3b24327835cd4e1842ee6e9b87ab06efa25a4bbf
2017-06-05 21:17:59 +02:00
Stephan Bergmann
0763d8413e Reduce loplugin:redundantcast warnings about functional casts even futher
Change-Id: I8884e17c453831e048c43012ee176093c5b2f99e
2017-06-05 21:17:55 +02:00
Andrea Gelmini
ac341548dc Fix typos
Change-Id: I9eb05432732a04e816946fbb13001df100a31f73
Reviewed-on: https://gerrit.libreoffice.org/38395
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-06-05 17:58:20 +02:00
Stephan Bergmann
c855400e96 Reduce loplugin:redundantcast warnings about functional casts even futher
Change-Id: Ieae9b5c9c7c6d9b8459e5d163f55d8f5024adfae
2017-06-02 14:00:08 +02:00
Stephan Bergmann
95645cbf0a Improved loplugin:redundantcast const_cast handling
Change-Id: I4c24ff5d9d5e74bef2a4040c6308c504282af55d
2017-06-02 13:31:37 +02:00
Stephan Bergmann
1fce984051 Make loplugin:redundantcast functional cast warnings more verbose
(useful when types involve typedefs)

Change-Id: I93e8962fd4b9c4ef79990e057dfa07538380008c
2017-06-02 10:35:05 +02:00
Stephan Bergmann
beae2dd6c8 Improved loplugin:redundantcast static_cast handling
Change-Id: I74e4ebda40f95661c5ae344132fcabbbf08ab0a4
2017-06-02 09:38:15 +02:00
Stephan Bergmann
93aeaa75a4 Improve suppression of loplugin:redundantcast in CPPUNIT_ASSERT
Change-Id: I65f95e7245f08592ea11cc75e1cf34dcbdf16b40
2017-06-01 14:37:02 +02:00
Stephan Bergmann
bef247d137 DataRecursionQueue was only introduced in Clang 3.8
(r253948 "Use data recursion in RecursiveASTVisitor when traversing Stmt and
Expr nodes")

Change-Id: I393474048ecbe0f6b7f19f00c2f830f495b2b6f0
2017-05-31 09:18:08 +02:00
Stephan Bergmann
7d858ad057 Restrict loplugin:redundantcast to "real" casts
Change-Id: Ifc9de898e5c9a084cbfd739625c679185c3a1534
2017-05-30 15:46:55 +02:00
Stephan Bergmann
3dda91dda8 Traverse InitListExpr only once
Arbitrarily chosing to traverse the semantic instead of the syntactic form.

Change-Id: Id1b4e49421a5550bb2fa9f0d7e6f83bf7abb6ebb
2017-05-30 14:39:23 +02:00
Stephan Bergmann
f6dda4e160 Make loplugin:redundantcast accept bool(FD_ISSET(...)) again
Change-Id: I4e96c55c246cf806f17df31844a00d0e8a5e4f56
2017-05-30 13:40:53 +02:00
Noel Grandin
2ccde70d60 teach redundantcast plugin about functional casts
Change-Id: Iac8ccd17d9e46ebb2cb55db7adb06c469bbd4ea0
Reviewed-on: https://gerrit.libreoffice.org/37910
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-05-30 08:50:31 +02:00
Stephan Bergmann
8b1fcedcd1 ...and re-eanble loplugin:stringcopy again
<http://reviews.llvm.org/D22128> "Make CastExpr::getSubExprAsWritten look
through implicit temporary under CK_ConstructorConversion" was biting me again.
(I had originally developed loplugin:stringcopy against a Clang build that
includes my local fix for that issue.  I really need to see to get that resolved
upstream...)

(And while 9578741684 "loplugin:stringcopy" was
actually a false positive, it doesn't hurt either, so just keep it.)

Change-Id: I726956adfbe67681005173cfdfed2e4b4cd6253d
2017-05-19 23:57:03 +02:00
Noel Grandin
f12096272e spelling, implictly->implicitly
Change-Id: I2d733ed3ce9395d11700d739cbd6d123649b4013
2017-05-03 11:18:21 +02:00
Noel Grandin
be8b9b4d29 loplugin:redundantcast find cstyle arithmetic casts
Change-Id: If7c259f0d12a41182f476ddb558f7cb5f76f9577
Reviewed-on: https://gerrit.libreoffice.org/36253
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-07 12:16:13 +00:00
Noel Grandin
26e7c6d6ab loplugin:redundantcast check for c-style char casts
Change-Id: Id6881262e370fd563ec29db95e4af5cfcb04ea34
Reviewed-on: https://gerrit.libreoffice.org/36247
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-04-07 07:07:40 +00:00
Stephan Bergmann
6b4a4bab6d Improved loplugin:redundantcast, static_cast on arithmetic types
Change-Id: I6e1f76de4b1ebf76ad02e7d0cd1374b4def83932
2017-04-06 18:33:20 +02:00