diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-20 21:07:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-21 13:15:32 +0200 |
commit | 7049328fb2d656d8454d4f704ad75d057e766c0b (patch) | |
tree | 0e8f2e1cce68c6a07c82d5e8496a64f716fecfde /compilerplugins/clang/test/stringadd.cxx | |
parent | a003e4ff69263c7feb8e97e3291e5579fbd181ac (diff) |
loplugin:stringadd replace OUStringLiteral temporaries with OUString::Concat
Change-Id: I656f06a74d9f0180ae460264563d6a935c7d2c60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114377
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/test/stringadd.cxx')
-rw-r--r-- | compilerplugins/clang/test/stringadd.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx index e17b207fcb64..a953e44062bb 100644 --- a/compilerplugins/clang/test/stringadd.cxx +++ b/compilerplugins/clang/test/stringadd.cxx @@ -36,6 +36,7 @@ void f1(OUString s1, int i, OString o) s2 += OUString::number(i); // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} s2 += XXX1; + // expected-error@+2 {{rather use O[U]String::Concat than constructing 'rtl::OUStringLiteral<4>' from 'const char16_t [4]' on LHS of + (where RHS is of type 'const char [4]') [loplugin:stringadd]}} // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} s2 += OUStringLiteral(XXX1u) + XXX2; @@ -200,9 +201,9 @@ void f1(OUString s, OUString t, int i, const char* pChar) { // no warning expected t = t + "xxx"; - // expected-error@+1 {{avoid constructing 'rtl::OUString' from 'const char [4]' on RHS of + (where LHS is of type 'rtl::OUString') [loplugin:stringadd]}} + // expected-error@+1 {{rather use O[U]String::Concat than constructing 'rtl::OUString' from 'const char [4]' on RHS of + (where LHS is of type 'rtl::OUString') [loplugin:stringadd]}} s = s + OUString("xxx"); - // expected-error@+1 {{avoid constructing 'rtl::OUString' from 'const rtl::OUString' on RHS of + (where LHS is of type 'rtl::OUString') [loplugin:stringadd]}} + // expected-error@+1 {{rather use O[U]String::Concat than constructing 'rtl::OUString' from 'const rtl::OUString' on RHS of + (where LHS is of type 'rtl::OUString') [loplugin:stringadd]}} s = s + OUString(getByRef()); // no warning expected @@ -220,9 +221,9 @@ void f1(OUString s, OUString t, int i, const char* pChar) void f2(char ch) { OString s; - // expected-error@+1 {{avoid constructing 'rtl::OString' from 'const char [4]' on RHS of + (where LHS is of type 'rtl::OString') [loplugin:stringadd]}} + // expected-error@+1 {{rather use O[U]String::Concat than constructing 'rtl::OString' from 'const char [4]' on RHS of + (where LHS is of type 'rtl::OString') [loplugin:stringadd]}} s = s + OString("xxx"); - // expected-error@+1 {{avoid constructing 'rtl::OString' from 'char' on RHS of + (where LHS is of type 'rtl::OString') [loplugin:stringadd]}} + // expected-error@+1 {{rather use O[U]String::Concat than constructing 'rtl::OString' from 'char' on RHS of + (where LHS is of type 'rtl::OString') [loplugin:stringadd]}} s = s + OString(ch); } } |