diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-08 13:32:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-09 06:43:34 +0100 |
commit | 0b11ce9dd26c93d53f19dab23ef48a8587e72fc3 (patch) | |
tree | 55e18b6e388a68bb7b3fac33a7b053fef9f74eca /compilerplugins/clang/test | |
parent | 22d36649a3087b9f8eec74c05fa33f87423619a4 (diff) |
loplugin:useuniqueptr extend to checking more local var deletes
Change-Id: I5da0f6ecd2577e92e679ed26dd42629dbac4afd4
Reviewed-on: https://gerrit.libreoffice.org/63132
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r-- | compilerplugins/clang/test/useuniqueptr.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compilerplugins/clang/test/useuniqueptr.cxx b/compilerplugins/clang/test/useuniqueptr.cxx index c8f67b46fa85..4cf6c96521ab 100644 --- a/compilerplugins/clang/test/useuniqueptr.cxx +++ b/compilerplugins/clang/test/useuniqueptr.cxx @@ -60,19 +60,19 @@ class Class5 { int* m_pbar[10]; // expected-note {{member is here [loplugin:useuniqueptr]}} ~Class5() { - for (auto p : m_pbar) - delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} + for (auto p : m_pbar) // expected-note {{var is here [loplugin:useuniqueptr]}} + delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} expected-error {{call to delete on a var, should be using std::unique_ptr [loplugin:useuniqueptr]}} } }; class Class5a { int* m_pbar[10]; // expected-note {{member is here [loplugin:useuniqueptr]}} ~Class5a() { - for (auto p : m_pbar) + for (auto p : m_pbar) // expected-note {{var is here [loplugin:useuniqueptr]}} { int x = 1; x = x + 2; - delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} + delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} expected-error {{call to delete on a var, should be using std::unique_ptr [loplugin:useuniqueptr]}} } } }; @@ -80,8 +80,8 @@ class Class6 { std::array<int*,10> m_pbar; // expected-note {{member is here [loplugin:useuniqueptr]}} ~Class6() { - for (auto p : m_pbar) - delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} + for (auto p : m_pbar) // expected-note {{var is here [loplugin:useuniqueptr]}} + delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} expected-error {{call to delete on a var, should be using std::unique_ptr [loplugin:useuniqueptr]}} } }; class Class7 { @@ -150,9 +150,9 @@ class Foo11 { std::vector<XXX*> m_pbar1; // expected-note {{member is here [loplugin:useuniqueptr]}} ~Foo11() { - for (const auto & p : m_pbar1) + for (const auto & p : m_pbar1) // expected-note {{var is here [loplugin:useuniqueptr]}} { - delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} + delete p; // expected-error {{rather manage this with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} expected-error {{call to delete on a var, should be using std::unique_ptr [loplugin:useuniqueptr]}} } } }; |