diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-10-14 12:59:56 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-10-14 13:54:26 +0200 |
commit | 8195c98dbabc01a11fa2dd73fefabcd6d331d7cf (patch) | |
tree | b589e6e80f29d298162aec24082b5b004da194f6 /compilerplugins | |
parent | c461e9d7a0d6fbb20dc6ac22ec049f1ff9100856 (diff) |
Fix loplugin:stringconcatauto
...after af2879e434fa0dc6b2a626617ed865e4f66eb5ad "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>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/stringconcatauto.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/test/stringconcatauto.cxx | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/compilerplugins/clang/stringconcatauto.cxx b/compilerplugins/clang/stringconcatauto.cxx index 02517a4db0ba..f228f865c677 100644 --- a/compilerplugins/clang/stringconcatauto.cxx +++ b/compilerplugins/clang/stringconcatauto.cxx @@ -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"; diff --git a/compilerplugins/clang/test/stringconcatauto.cxx b/compilerplugins/clang/test/stringconcatauto.cxx index 72044f80b150..9fed0b83c75c 100644 --- a/compilerplugins/clang/test/stringconcatauto.cxx +++ b/compilerplugins/clang/test/stringconcatauto.cxx @@ -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) |