6 Commits

Author SHA1 Message Date
Stephan Bergmann
f8d23c84fc Improve loplugin:dyncastvisibility a bit
Change-Id: Iab9d333d08a8b90a69f3a096e5f39baf3e7bb638
Reviewed-on: https://gerrit.libreoffice.org/50279
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-02-25 14:21:47 +01:00
Stephan Bergmann
b35bb38f18 Clean away temporarily added using declarations
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-11-07 11:50:47 +01:00
Stephan Bergmann
948c9c0a31 Use unique class names for better FlameGraph results
...of measuring loplugin performance, when gathering data with perf and all
plugins that used "Visitor" as class name were lumped together.  (Cf.
<https://whatofhow.wordpress.com/2016/06/28/plugin-flamed/>.)

Change-Id: Ie482f443faced7469528da4772e735bc2eda596d
Reviewed-on: https://gerrit.libreoffice.org/43324
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
2017-10-11 14:26:44 +02:00
Stephan Bergmann
b4c9c0d137 More clang::*Type vs. llvm::*Type ambiguities
Change-Id: I21133976793ab018c633dda077029666308526db
2017-09-11 10:48:12 +02:00
Stephan Bergmann
4f2bc21685 When traversing a TemplateDecl, ts can be a dependent type
Change-Id: I05b02ef807a12a802720f58cd5a2d6d370b42418
2017-09-05 09:38:58 +02:00
Stephan Bergmann
595371e520 New loplugin:dyncastvisibility
...to find uses of dynamic_cast where the static (base) type has hidden
visibility while the dynamic (derived) one has default visibility, and which may
thus fail at least on macOS like happened in
d5ed3cd6dbd22bb18542778f1c48f4d5b3ae0f95 "Make WinMtfFontStyle's base class
EMFIO_DLLPUBLIC, too".

libcxxabi's __dynamic_cast takes static_type and dst_type arguments.  Now, if
dst_type (the derived type, with default visibility) is taken from .so A (and
thus references the version of the base type info hidden in .so A) but the
__dynamic_cast call is made from .so B, it passes for static_type the base type
information hidden in .so B, and __dynamic_cast will consider the cast to fail.
I'm not sure whether hidden intermediary types (in the hierarchy between the
dynamic_cast's base and derived types) acutally cause a problem too, but lets
flag them with the plugin anyway.

The fixes use SAL_DLLPUBLIC_RTTI.  For one, there appear to be no other reasons
than type visibility to make those classes SAL_DLLPUBLIC.  For another, this
nicely avoids any actual changes on Windows (where SAL_DLLPUBLIC expands to
nothing, and many of the affected classes were explicityl introduced into class
hierarchies as "MSVC hacks").

Change-Id: Ia85a9635cebffb1009a9efc1484b8bd4025585d4
Reviewed-on: https://gerrit.libreoffice.org/41802
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2017-09-04 09:08:16 +02:00