Avoid loplugin:stringviewparam when there already is a string_view overload

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 12 January 2021 21:28 UTC

This avoids clang-cl

> In file included from core/connectivity/source/drivers/ado/Aolevariant.cxx:20: > connectivity/source/inc\ado/Aolevariant.hxx(72,40): error: replace function parameter of type 'const rtl::OUString &' with 'std::u16string_view' [loplugin:stringviewparam] > OLEVariant(const OUString& us) > ~~~~~~~~~~~~~~~~^~

which would make that OLEVariant ctor overload redundant with the existing

OLEVariant(std::u16string_view us);

overload, but with the OUString overload gone, implicit conversions from OUString to OLEVariant would no longer work, e.g.,

> connectivity/source/drivers/ado/AColumn.cxx(184,76): error: no viable conversion from 'rtl::OUString' to 'const connectivity::ado::OLEVariant' > OTools::putValue(m_aColumn.get_Properties(), sAdoPropertyName, getString(rValue)); > ^~~~~~~~~~~~~~~~~

Change-Id: I92a5cc29d9fd2a5ff1a951f79df64879d0f71743 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109180

94f6765d6ecc Avoid loplugin:stringviewparam when there already is a string_view overload
compilerplugins/clang/stringviewparam.cxx | 55 ++++++++++++++++++++++++++
compilerplugins/clang/test/stringviewparam.cxx | 12 ++++++
2 files changed, 67 insertions(+)

Upstream: cgit.freedesktop.org


  • Share