summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test
diff options
context:
space:
mode:
authorNoel <noel.grandin@collabora.co.uk>2021-02-10 20:33:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-02-23 12:11:31 +0100
commitc13133b613fda3255fab60c03012aff93a5f2f02 (patch)
treeb07846fbcb4bac7c3a24f0570f60b1b6e759fd8f /compilerplugins/clang/test
parentc181e510c5f5e74f1f6824b64637849aace9ae63 (diff)
loplugin:refcounting check for managing OWeakObject with raw pointer
Change-Id: I7471725f1e658940b5e6993361c327be6ccf0d31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111064 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r--compilerplugins/clang/test/refcounting.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/refcounting.cxx b/compilerplugins/clang/test/refcounting.cxx
index 8a1f277829cc..ca27ac0614a7 100644
--- a/compilerplugins/clang/test/refcounting.cxx
+++ b/compilerplugins/clang/test/refcounting.cxx
@@ -18,6 +18,8 @@ namespace cppu
{
class OWeakObject
{
+ void acquire();
+ void release();
};
}
@@ -72,4 +74,13 @@ void dummy(Dependent<Dummy>* p1, Dependent<UnoObject>* p2)
p2->g();
}
+void foo4()
+{
+ // expected-error@+1 {{cppu::OWeakObject subclass 'UnoObject' being managed via raw pointer, should be managed via rtl::Reference [loplugin:refcounting]}}
+ UnoObject* p = new UnoObject;
+ (void)p;
+ // expected-error@+1 {{cppu::OWeakObject subclass 'UnoObject' being managed via raw pointer, should be managed via rtl::Reference [loplugin:refcounting]}}
+ p = new UnoObject;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */