diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-13 10:50:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-13 11:58:10 +0200 |
commit | dbf8ad9bc385411c349095dfa66345464b4215d6 (patch) | |
tree | 507ac08bf144fa8ac44ad4889ce127cb0d0c70c7 /compilerplugins | |
parent | b0e2dbca5164c494a669bd48f8ff058f4c1ad710 (diff) |
loplugin:useuniqueptr in SbUnoStructRefObject
now that we have upgraded to VS2017, we can use std::unique_ptr in
std::map
Change-Id: Id01af07ccae7447405b8f0bc44b08043f453e54b
Reviewed-on: https://gerrit.libreoffice.org/57384
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/test/useuniqueptr.cxx | 5 | ||||
-rw-r--r-- | compilerplugins/clang/useuniqueptr.cxx | 3 |
2 files changed, 2 insertions, 6 deletions
diff --git a/compilerplugins/clang/test/useuniqueptr.cxx b/compilerplugins/clang/test/useuniqueptr.cxx index c7c92313a5e6..24a34c0e54b9 100644 --- a/compilerplugins/clang/test/useuniqueptr.cxx +++ b/compilerplugins/clang/test/useuniqueptr.cxx @@ -77,13 +77,12 @@ class Class7 { delete m_pbar[i]; // expected-error {{rather manage with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} } }; -// don't warn for maps, MSVC 2015 has problems with mixing std::map/std::unordered_map and std::unique_ptr class Class8 { - std::unordered_map<int, int*> m_pbar; + std::unordered_map<int, int*> m_pbar; // expected-note {{member is here [loplugin:useuniqueptr]}} ~Class8() { for (auto i : m_pbar) - delete i.second; + delete i.second; // expected-error {{rather manage with std::some_container<std::unique_ptr<T>> [loplugin:useuniqueptr]}} } }; class Foo8 { diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index 0af8cd295a6b..0520546052a4 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -288,10 +288,7 @@ void UseUniquePtr::CheckDeleteExpr(const CXXMethodDecl* methodDecl, const CXXDel // the std::vector is being passed to another class if (loplugin::isSamePathname(aFileName, SRCDIR "/sfx2/source/explorer/nochaos.cxx")) return; - // ignore std::map and std::unordered_map, MSVC 2015 has problems with mixing these with std::unique_ptr auto tc = loplugin::TypeCheck(fieldDecl->getType()); - if (tc.Class("map").StdNamespace() || tc.Class("unordered_map").StdNamespace()) - return; // these sw::Ring based classes do not lend themselves to std::unique_ptr management if (tc.Pointer().Class("SwNodeIndex").GlobalNamespace() || tc.Pointer().Class("SwShellTableCursor").GlobalNamespace() || tc.Pointer().Class("SwBlockCursor").GlobalNamespace() || tc.Pointer().Class("SwVisibleCursor").GlobalNamespace() |