1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 #include <rtl/ref.hxx>
12 #include <tools/gen.hxx>
23 std::unique_ptr
<int> m_pbar1
;
24 rtl::Reference
<Foo
> m_pbar2
;
27 // expected-error@-1 {{no need to explicitly init an instance of 'std::unique_ptr<int>' with nullptr, just use default constructor [loplugin:simplifyconstruct]}}
29 // expected-error@-1 {{no need to explicitly init an instance of 'rtl::Reference<Foo>' with nullptr, just use default constructor [loplugin:simplifyconstruct]}}
35 // no warning expected when using std::unique_ptr constructor with a custom deleter
47 std::unique_ptr
<IUnknown
, void (*)(IUnknown
* p
)> aITypeLibGuard(nullptr, [](IUnknown
* p
) {
63 // expected-error@+1 {{simplify [loplugin:simplifyconstruct]}}
64 rtl::Reference
<Foo
> x
= rtl::Reference(f
);
68 // no warning expected
76 void f(Foo
* f
) { auto x
= rtl::Reference(f
); }
83 // expected-error@+1 {{simplify [loplugin:simplifyconstruct]}}
84 tools::Rectangle x
= tools::Rectangle(10, 10, 10, 10);
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */