summaryrefslogtreecommitdiffstats
path: root/compilerplugins/clang/test/simplifyconstruct.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/test/simplifyconstruct.cxx')
-rw-r--r--compilerplugins/clang/test/simplifyconstruct.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/simplifyconstruct.cxx b/compilerplugins/clang/test/simplifyconstruct.cxx
index ca4b3a1a198c..8fbffc8ba2d7 100644
--- a/compilerplugins/clang/test/simplifyconstruct.cxx
+++ b/compilerplugins/clang/test/simplifyconstruct.cxx
@@ -10,6 +10,8 @@
#include <memory>
#include <rtl/ref.hxx>
+namespace test1
+{
struct Foo
{
void acquire();
@@ -27,8 +29,11 @@ class Foo1
{
}
};
+}
// no warning expected when using std::unique_ptr constructor with a custom deleter
+namespace test2
+{
struct ITypeLib
{
};
@@ -43,5 +48,31 @@ void func2()
p->Release();
});
}
+}
+
+namespace test3
+{
+struct Foo
+{
+ void acquire();
+ void release();
+};
+void f(Foo* f)
+{
+ // expected-error@+1 {{simplify [loplugin:simplifyconstruct]}}
+ rtl::Reference<Foo> x = rtl::Reference(f);
+}
+}
+
+// no warning expected
+namespace test4
+{
+struct Foo
+{
+ void acquire();
+ void release();
+};
+void f(Foo* f) { auto x = rtl::Reference(f); }
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */