Fix loplugin:stringconcatauto

...after af2879e434 "Deduplicate stringconcat
more" changed the *StringNumberBase::toAsciiUperCase return typr from
O[U]StringNumber to the underlying StringNumberBase.  (And where that commit had
added some odd check for a non-existing "StringNumber" type to
compilerplugins/clang/stringconcatauto.cxx, presumably in error.)

Change-Id: I622e6ae30fcec8f081c978eaf67ffb716a10ee4e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141363
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2022-10-14 12:59:56 +02:00
parent c461e9d7a0
commit 8195c98dba
2 changed files with 11 additions and 1 deletions

View File

@@ -85,7 +85,7 @@ bool StringConcatAuto::checkDecl( const DeclaratorDecl* decl, QualType type, con
const char* typeString = nullptr;
if( tc.Struct("StringConcat").Namespace("rtl").GlobalNamespace())
typeString = "O(U)String";
else if( tc.Struct("StringNumber").Namespace("rtl").GlobalNamespace())
else if( tc.Struct("StringNumberBase").Namespace("rtl").GlobalNamespace())
typeString = "O(U)String";
else if( tc.Struct("OUStringNumber").Namespace("rtl").GlobalNamespace())
typeString = "OUString";

View File

@@ -26,11 +26,15 @@ void foo()
auto str5 = OUString::number(50);
// expected-error-re@-1 {{creating a variable of type '{{(rtl::)?}}OUStringNumber<{{.*}}>' will make it reference temporaries}}
// expected-note@-2 {{use OUString instead}}
auto str6 = OUString::number(50).toAsciiUpperCase();
// expected-error-re@-1 {{creating a variable of type '{{(rtl::)?}}StringNumberBase<{{.*}}>' will make it reference temporaries}}
// expected-note@-2 {{use O(U)String instead}}
(void)str1;
(void)str2;
(void)str3;
(void)str4;
(void)str5;
(void)str6;
}
struct A
@@ -47,6 +51,12 @@ struct A
{
return OString::number(120);
}
auto baz2()
// expected-error-re@-1 {{returning a variable of type '{{(rtl::)?}}StringNumberBase<{{.*}}>' will make it reference temporaries}}
// expected-note@-2 {{use O(U)String instead}}
{
return OString::number(120).toAsciiUpperCase();
}
};
template <typename T> void fun(const T& par)