summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-10-11 10:23:28 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-10-11 12:46:01 +0200
commit3d236177be255b2027a997bfc12fe0833ca9a2f7 (patch)
treed67582e355bccb43cf133c1857f5dd6136be2f35 /compilerplugins
parent6c65c62c26a8aa4d04466545f8f04ec86b797012 (diff)
Deduplicate O(U)StringConcatenation
And use an overloaded helper function with a better (?) unified name to show that the result is not an O(U)String. Change-Id: I8956338b05d02bf46a6185828130ea8ef145d46b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141203 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/stringview.cxx2
-rw-r--r--compilerplugins/clang/test/stringview.cxx4
2 files changed, 3 insertions, 3 deletions
diff --git a/compilerplugins/clang/stringview.cxx b/compilerplugins/clang/stringview.cxx
index 1be16fb89a4f..c1606908dbc7 100644
--- a/compilerplugins/clang/stringview.cxx
+++ b/compilerplugins/clang/stringview.cxx
@@ -264,7 +264,7 @@ void StringView::handleCXXConstructExpr(CXXConstructExpr const* expr)
"instead of an %0%select{| constructed from a %2}1, pass a"
" '%select{std::string_view|std::u16string_view}3'"
"%select{| (or an '%select{rtl::OStringChar|rtl::OUStringChar}3')|"
- " via '%select{rtl::OStringConcatenation|rtl::OUStringConcatenation}3'}4",
+ " via '%select{rtl::Concat2View|rtl::Concat2View}3'}4",
expr->getExprLoc())
<< expr->getType() << (argType.isNull() ? 0 : 1) << argType
<< (loplugin::TypeCheck(expr->getType()).Class("OString").Namespace("rtl").GlobalNamespace()
diff --git a/compilerplugins/clang/test/stringview.cxx b/compilerplugins/clang/test/stringview.cxx
index a2b07501a49e..f578a5f50e8d 100644
--- a/compilerplugins/clang/test/stringview.cxx
+++ b/compilerplugins/clang/test/stringview.cxx
@@ -167,7 +167,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, sal_Int32 n2, OString
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]}}
call_view(OString(OString::number(0)));
- // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed from a 'typename std::enable_if_t<ToStringHelper<OString>::allowOStringConcat && ToStringHelper<OString>::allowOStringConcat, OStringConcat<OString, OString>{{ ?}}>' (aka 'rtl::OStringConcat<rtl::OString, rtl::OString>'), pass a 'std::string_view' via 'rtl::OStringConcatenation' [loplugin:stringview]}}
+ // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OString' constructed from a 'typename std::enable_if_t<ToStringHelper<OString>::allowOStringConcat && ToStringHelper<OString>::allowOStringConcat, OStringConcat<OString, OString>{{ ?}}>' (aka 'rtl::OStringConcat<rtl::OString, rtl::OString>'), pass a 'std::string_view' via 'rtl::Concat2View' [loplugin:stringview]}}
call_view(OString(s3 + s3));
// expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString', pass a 'std::u16string_view' [loplugin:stringview]}}
call_view(OUString());
@@ -192,7 +192,7 @@ void f5(char const* s1, sal_Int32 n1, char16_t const* s2, sal_Int32 n2, OString
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]}}
call_view(OUString(OUString::number(0)));
- // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'typename std::enable_if_t<ToStringHelper<OUString>::allowOUStringConcat && ToStringHelper<OUString>::allowOUStringConcat, OUStringConcat<OUString, OUString>{{ ?}}>' (aka 'rtl::OUStringConcat<rtl::OUString, rtl::OUString>'), pass a 'std::u16string_view' via 'rtl::OUStringConcatenation' [loplugin:stringview]}}
+ // expected-error-re@+1 {{instead of an '{{(rtl::)?}}OUString' constructed from a 'typename std::enable_if_t<ToStringHelper<OUString>::allowOUStringConcat && ToStringHelper<OUString>::allowOUStringConcat, OUStringConcat<OUString, OUString>{{ ?}}>' (aka 'rtl::OUStringConcat<rtl::OUString, rtl::OUString>'), pass a 'std::u16string_view' via 'rtl::Concat2View' [loplugin:stringview]}}
call_view(OUString(s4 + s4));
(void)(s3 == l1);