summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-11 22:24:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-12 12:42:15 +0200
commitcbaf1fbaa6e707d939f815eda360fad68a492aca (patch)
tree20b3dfeac257130afb01572b2c117b7840d07007 /compilerplugins
parentf751417b77e6573a0c639778e76ec943449f4573 (diff)
loplugin:stringview more o3tl conversion
look for call sequences that can use string_view and the new o3tl functions in o3tl/string_view.hxx Also add a few more wrappers to said #include file Change-Id: I05d8752cc67a7b55b0b57e8eed803bd06bfcd9ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/stringview.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/compilerplugins/clang/stringview.cxx b/compilerplugins/clang/stringview.cxx
index e706f4b397da..bcb8b79eded6 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -47,7 +47,12 @@ public:
loplugin::isSamePathname(fn, SRCDIR "/sal/qa/OStringBuffer/rtl_OStringBuffer.cxx")
|| loplugin::isSamePathname(fn, SRCDIR "/sal/qa/rtl/strings/test_ostring_concat.cxx")
|| loplugin::isSamePathname(fn, SRCDIR "/sal/qa/rtl/strings/test_oustring_concat.cxx")
- || loplugin::isSamePathname(fn, SRCDIR "/sal/qa/rtl/oustring/rtl_OUString2.cxx"));
+ || loplugin::isSamePathname(fn, SRCDIR "/sal/qa/rtl/oustring/rtl_OUString2.cxx")
+ || loplugin::isSamePathname(fn, SRCDIR "/sal/qa/rtl/strings/test_oustring_compare.cxx")
+ || loplugin::isSamePathname(fn,
+ SRCDIR "/sal/qa/rtl/strings/test_oustring_startswith.cxx")
+ || loplugin::isSamePathname(fn, SRCDIR
+ "/sal/qa/rtl/strings/test_strings_defaultstringview.cxx"));
}
virtual void run() override
@@ -371,7 +376,10 @@ bool StringView::VisitCXXMemberCallExpr(CXXMemberCallExpr const* expr)
|| tc.Class("OString").Namespace("rtl").GlobalNamespace())
{
auto const dc = loplugin::DeclCheck(expr->getMethodDecl());
- if (dc.Function("toInt32") || dc.Function("toInt64"))
+ if (dc.Function("toInt32") || dc.Function("toInt64") || dc.Function("toDouble")
+ || dc.Function("equalsIgnoreAsciiCase") || dc.Function("compareToIgnoreAsciiCase")
+ || dc.Function("trim") || dc.Function("startsWith") || dc.Function("endsWith")
+ || dc.Function("match"))
{
handleSubExprThatCouldBeView(expr->getImplicitObjectArgument());
}