Commit Graph

6 Commits

Author SHA1 Message Date
Stephan Bergmann
4f294e6976 Avoid some unhelpful loplugin:makeshared
...like

> canvas/source/directx/dx_impltools.cxx(137,31): error: rather use make_shared than constructing from 'Gdiplus::Graphics *' [loplugin:makeshared]
>             GraphicsSharedPtr pRet(Gdiplus::Graphics::FromImage(rBitmap.get()));
>                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

on Windows, where those functions like FromImage are provided by Windows (so we
can't help it that they are returning pointers)

Change-Id: Iae5c4b20d64cc6b38ff66409519fbd25f6e509cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100095
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-04 18:47:10 +02:00
Noel Grandin
ed8152b1ed improve loplugin:makeshared
to find places where we are converting stuff to unique_ptr
instead of using std::make_shared.

As a bonus, this tends to find places where we are using shared_ptr
where we can instead be using unique_ptr avoiding the locking overhead.

Change-Id: I1b57bbc4a6c766b48bba8e25a55161800e149f62
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93207
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-01 08:26:24 +02:00
Stephan Bergmann
1446e097e7 Fix loplugin:makeshared for libc++
...where the std::make_shared ctor has a default argument,

> template<class _Yp>
>     explicit shared_ptr(_Yp* __p,
>                         typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());

Change-Id: Ia97d16f64a7e9b4f48112b033dcdb6722d4da791
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87552
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-01-27 23:13:57 +01:00
Stephan Bergmann
606baaeea6 loplugin:makeshared: Fix call to clang::NamedDecl::getName
...which caused

> llvm::StringRef clang::NamedDecl::getName() const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed.

when compiling e.g. comphelper/source/misc/lok.cxx

Change-Id: Ie83e7fb42fae1093058caea320973bc23a90bee9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87526
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2020-01-27 18:27:43 +01:00
Noel Grandin
2d4707f1e5 turn on loplugin:makeshared
Change-Id: Ic1baa3971e34c7df20ad7d3278c4fddc52b28a19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87413
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-27 07:14:24 +01:00
Noel Grandin
8dd247044f new loplugin:makeshared
Change-Id: I4bfcf6e337a6806ab5983a3fa2e2a7b6f2af1c43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87270
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-24 07:18:20 +01:00