summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-05 07:22:35 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-04-05 09:57:04 +0200
commit90c590812eecb3a0eb2748a132e304fa6c0ea0ad (patch)
treed7747887c767c2b5a6b8cc4c60fc9f8f856c49a7 /compilerplugins
parent53e24da3698ddb5f976cec0ae8eb8b2a2ab2c4c6 (diff)
Simplify O(U)String::number implementation
Change-Id: I059f0324597a90aee01c95170a48ac5578f3caee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150037 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/stringview.cxx4
-rw-r--r--compilerplugins/clang/test/stringview.cxx4
2 files changed, 3 insertions, 5 deletions
diff --git a/compilerplugins/clang/stringview.cxx b/compilerplugins/clang/stringview.cxx
index 7d6d38ba3b60..4978c802c55b 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -196,9 +196,7 @@ void StringView::handleCXXConstructExpr(CXXConstructExpr const* expr)
break;
}
loplugin::TypeCheck tc(t);
- if (tc.RvalueReference().Struct("StringNumberBase").Namespace("rtl").GlobalNamespace()
- || tc.RvalueReference().Struct("OStringNumber").Namespace("rtl").GlobalNamespace()
- || tc.RvalueReference().Struct("OUStringNumber").Namespace("rtl").GlobalNamespace()
+ if (tc.RvalueReference().Struct("StringNumber").Namespace("rtl").GlobalNamespace()
|| tc.ClassOrStruct("basic_string_view").StdNamespace())
{
argType = expr->getArg(0)->IgnoreImplicit()->getType();
diff --git a/compilerplugins/clang/test/stringview.cxx b/compilerplugins/clang/test/stringview.cxx
index f1a63a058bdf..d9e0508c0835 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -164,7 +164,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, sal_Int32 n2, OString
call_view(OString(l1));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed from a 'std::string_view' (aka 'basic_string_view<char>'), pass a 'std::string_view' [loplugin:stringview]}}
call_view(OString(std::string_view("foo")));
- // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed from a 'OStringNumber<int>', pass a 'std::string_view' [loplugin:stringview]}}
+ // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed from a '{{(rtl::)?}}StringNumber<char, 33>', pass a 'std::string_view' [loplugin:stringview]}}
call_view(OString(OString::number(0)));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed from a 'OStringConcat<{{(rtl::)?}}OString, {{(rtl::)?}}OString>' (aka 'StringConcat<char, rtl::OString, rtl::OString>'), pass a 'std::string_view' via 'rtl::Concat2View' [loplugin:stringview]}}
call_view(OString(s3 + s3));
@@ -188,7 +188,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, sal_Int32 n2, OString
call_view(OUString(l2));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'std::u16string_view' (aka 'basic_string_view<char16_t>'), pass a 'std::u16string_view' [loplugin:stringview]}}
call_view(OUString(std::u16string_view(u"foo")));
- // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'OUStringNumber<int>', pass a 'std::u16string_view' [loplugin:stringview]}}
+ // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a '{{(rtl::)?}}StringNumber<char16_t, 33>', pass a 'std::u16string_view' [loplugin:stringview]}}
call_view(OUString(OUString::number(0)));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'OUStringConcat<{{(rtl::)?}}OUString, {{(rtl::)?}}OUString>' (aka 'StringConcat<char16_t, rtl::OUString, rtl::OUString>'), pass a 'std::u16string_view' via 'rtl::Concat2View' [loplugin:stringview]}}
call_view(OUString(s4 + s4));