diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-23 10:15:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-23 15:25:26 +0200 |
commit | 8a54339fc83fe9abaaace6f9f374697e6923d684 (patch) | |
tree | 516e82bb9eca2d586aa7acebbe369f67ff707a7f /compilerplugins/clang/test/referencecasting.cxx | |
parent | d34f1df73806e9ca05fa0d07da619e2c0f01b6f7 (diff) |
loplugin:referencecasting look through more clang Types
Note that because of where the fix resides, loplugin:redundantcast
also notices a few more things.
Change-Id: I0b66047fadfff2c5ceafcbd3eab085de00d861a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120865
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test/referencecasting.cxx')
-rw-r--r-- | compilerplugins/clang/test/referencecasting.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/referencecasting.cxx b/compilerplugins/clang/test/referencecasting.cxx index a6850ed660ea..1b1e75f90cea 100644 --- a/compilerplugins/clang/test/referencecasting.cxx +++ b/compilerplugins/clang/test/referencecasting.cxx @@ -13,8 +13,10 @@ #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/io/XStreamListener.hpp" +#include "com/sun/star/io/XInputStream.hpp" #include "com/sun/star/lang/XTypeProvider.hpp" #include "com/sun/star/lang/XComponent.hpp" +#include "cppuhelper/implbase.hxx" #include "cppuhelper/weak.hxx" #include "rtl/ref.hxx" @@ -192,4 +194,24 @@ void test14(css::uno::Sequence<css::uno::Reference<css::io::XStreamListener>> se } } +namespace test15 +{ +class Foo : public cppu::WeakImplHelper<css::lang::XComponent, css::io::XInputStream> +{ + virtual ~Foo(); + css::uno::Reference<css::lang::XTypeProvider> bar() + { + // expected-error@+1 {{the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]}} + return css::uno::Reference<css::lang::XTypeProvider>( + static_cast<css::lang::XTypeProvider*>(this), css::uno::UNO_QUERY); + } + css::uno::Reference<css::io::XInputStream> bar2() + { + // expected-error@+1 {{the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]}} + return css::uno::Reference<css::io::XInputStream>(static_cast<css::io::XInputStream*>(this), + css::uno::UNO_QUERY); + } +}; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |