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:
@@ -85,7 +85,7 @@ bool StringConcatAuto::checkDecl( const DeclaratorDecl* decl, QualType type, con
|
|||||||
const char* typeString = nullptr;
|
const char* typeString = nullptr;
|
||||||
if( tc.Struct("StringConcat").Namespace("rtl").GlobalNamespace())
|
if( tc.Struct("StringConcat").Namespace("rtl").GlobalNamespace())
|
||||||
typeString = "O(U)String";
|
typeString = "O(U)String";
|
||||||
else if( tc.Struct("StringNumber").Namespace("rtl").GlobalNamespace())
|
else if( tc.Struct("StringNumberBase").Namespace("rtl").GlobalNamespace())
|
||||||
typeString = "O(U)String";
|
typeString = "O(U)String";
|
||||||
else if( tc.Struct("OUStringNumber").Namespace("rtl").GlobalNamespace())
|
else if( tc.Struct("OUStringNumber").Namespace("rtl").GlobalNamespace())
|
||||||
typeString = "OUString";
|
typeString = "OUString";
|
||||||
|
@@ -26,11 +26,15 @@ void foo()
|
|||||||
auto str5 = OUString::number(50);
|
auto str5 = OUString::number(50);
|
||||||
// expected-error-re@-1 {{creating a variable of type '{{(rtl::)?}}OUStringNumber<{{.*}}>' will make it reference temporaries}}
|
// expected-error-re@-1 {{creating a variable of type '{{(rtl::)?}}OUStringNumber<{{.*}}>' will make it reference temporaries}}
|
||||||
// expected-note@-2 {{use OUString instead}}
|
// 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)str1;
|
||||||
(void)str2;
|
(void)str2;
|
||||||
(void)str3;
|
(void)str3;
|
||||||
(void)str4;
|
(void)str4;
|
||||||
(void)str5;
|
(void)str5;
|
||||||
|
(void)str6;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct A
|
struct A
|
||||||
@@ -47,6 +51,12 @@ struct A
|
|||||||
{
|
{
|
||||||
return OString::number(120);
|
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)
|
template <typename T> void fun(const T& par)
|
||||||
|
Reference in New Issue
Block a user