summaryrefslogtreecommitdiff
path: root/cppu/qa
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-26 16:02:39 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-31 06:25:45 +0000
commit0b23eec200c8c12db5778405df44f4bf8e38e4ad (patch)
treeee45856fe1781195c51f63835024865f283cdab8 /cppu/qa
parent88c03cd07a171e05c7fb4dcade8baa28e7c5a770 (diff)
teach refcounting clang plugin about uno::Reference
uno::Reference is only allowed to used with classes that have a ::static_type member. So convert all those places to rtl::Reference. Maybe we need some LIBO_INTERNAL_ONLY constructors on rtl::Reference and uno::Reference to make this a little smoother? Change-Id: Icdcb35d71ca40a87b1dc474096776412adbfc7e3 Reviewed-on: https://gerrit.libreoffice.org/25516 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'cppu/qa')
-rw-r--r--cppu/qa/test_reference.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/cppu/qa/test_reference.cxx b/cppu/qa/test_reference.cxx
index df57eab424da..16d14d9d2ff7 100644
--- a/cppu/qa/test_reference.cxx
+++ b/cppu/qa/test_reference.cxx
@@ -90,8 +90,12 @@ private:
struct Base1: public css::uno::XInterface {
virtual ~Base1() = delete;
+ static ::css::uno::Type const & SAL_CALL static_type(void * = nullptr) // loplugin:refcounting
+ { return ::cppu::UnoType<Base1>::get(); }
+};
+struct Base2: public Base1 {
+ virtual ~Base2() = delete;
};
-struct Base2: public Base1 { virtual ~Base2() = delete; };
struct Base3: public Base1 { virtual ~Base3() = delete; };
struct Derived: public Base2, public Base3 {
virtual ~Derived() = delete;
@@ -100,7 +104,10 @@ struct Derived: public Base2, public Base3 {
// The special case using the conversion operator instead:
css::uno::Reference< css::uno::XInterface > testUpcast1(
css::uno::Reference< Derived > const & ref)
-{ return ref; }
+{
+ Base1::static_type(); // prevent loplugin:unreffun firing
+ return ref;
+}
// The normal up-cast case:
css::uno::Reference< Base1 > testUpcast2(