diff options
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) |