diff options
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/stringstatic.cxx | 4 | ||||
-rw-r--r-- | compilerplugins/clang/test/conditionalstring.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/test/elidestringvar.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/test/staticvar.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/test/stringadd.cxx | 3 | ||||
-rw-r--r-- | compilerplugins/clang/test/stringconcatliterals.cxx | 14 |
6 files changed, 15 insertions, 12 deletions
diff --git a/compilerplugins/clang/stringstatic.cxx b/compilerplugins/clang/stringstatic.cxx index 61dfb584ddf5..c5753445fc34 100644 --- a/compilerplugins/clang/stringstatic.cxx +++ b/compilerplugins/clang/stringstatic.cxx @@ -17,8 +17,8 @@ /** Look for static O*String and O*String[], they can be more efficiently declared as: - static const OUStringLiteral our_aLBEntryMap[] = {" ", ", "}; - static const OUStringLiteral sName("name"); + static const OUStringLiteral our_aLBEntryMap[] = {u" ", u", "}; + static const OUStringLiteral sName(u"name"); which is more efficient at startup time. */ diff --git a/compilerplugins/clang/test/conditionalstring.cxx b/compilerplugins/clang/test/conditionalstring.cxx index e10b02519f8e..f38bc1d2436f 100644 --- a/compilerplugins/clang/test/conditionalstring.cxx +++ b/compilerplugins/clang/test/conditionalstring.cxx @@ -18,7 +18,7 @@ void f(OUString s, bool b) s += (b ? OUString("a") : throw 0); // expected-error@+2 {{replace 2nd operand of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}} // expected-note@+1 {{conditional expression is here [loplugin:conditionalstring]}} - s += (b ? OUString("a") : OUStringLiteral("b")); + s += (b ? OUString("a") : OUStringLiteral(u"b")); // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}} b = (b ? ("x") : (OUString(("y")))) == s; // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}} diff --git a/compilerplugins/clang/test/elidestringvar.cxx b/compilerplugins/clang/test/elidestringvar.cxx index e7a5f40a8eae..bc0de05c999e 100644 --- a/compilerplugins/clang/test/elidestringvar.cxx +++ b/compilerplugins/clang/test/elidestringvar.cxx @@ -19,7 +19,7 @@ OUString f(sal_Unicode c, int n) // expected-note@+1 {{literal OUString variable defined here [loplugin:elidestringvar]}} OUString s3(u'a'); // expected-note@+1 {{literal OUString variable defined here [loplugin:elidestringvar]}} - OUString s4 = OUStringLiteral("a"); + OUString s4 = OUStringLiteral(u"a"); switch (n) { case 1: diff --git a/compilerplugins/clang/test/staticvar.cxx b/compilerplugins/clang/test/staticvar.cxx index 3ae040a2e5a0..f527df6a521a 100644 --- a/compilerplugins/clang/test/staticvar.cxx +++ b/compilerplugins/clang/test/staticvar.cxx @@ -58,7 +58,7 @@ struct S4 S4 const& f4() { static const S4 s1[] = { - { OUStringLiteral("/DocColor"), false }, + { OUStringLiteral(u"/DocColor"), false }, }; return s1[0]; } diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx index 748ee35cfe61..0879805d3449 100644 --- a/compilerplugins/clang/test/stringadd.cxx +++ b/compilerplugins/clang/test/stringadd.cxx @@ -18,6 +18,7 @@ namespace test1 { static const char XXX1[] = "xxx"; +static const char16_t XXX1u[] = u"xxx"; static const char XXX2[] = "xxx"; void f1(OUString s1, int i, OString o) { @@ -36,7 +37,7 @@ void f1(OUString s1, int i, OString o) // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} s2 += XXX1; // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} - s2 += OUStringLiteral(XXX1) + XXX2; + s2 += OUStringLiteral(XXX1u) + XXX2; // expected-error@+1 {{simplify by merging with the preceding assignment [loplugin:stringadd]}} s2 += OStringToOUString(o, RTL_TEXTENCODING_UTF8); diff --git a/compilerplugins/clang/test/stringconcatliterals.cxx b/compilerplugins/clang/test/stringconcatliterals.cxx index e2d5a8ce20e3..76b82797f77e 100644 --- a/compilerplugins/clang/test/stringconcatliterals.cxx +++ b/compilerplugins/clang/test/stringconcatliterals.cxx @@ -15,10 +15,12 @@ #include <rtl/ustring.hxx> #define FOO "foo" +#define FOOu u"foo" void f(std::ostream& s1) { static char const foo[] = "foo"; + static char16_t const foou[] = u"foo"; s1 << "foo" << "foo"; // expected-error@-1 {{replace '<<' between string literals with juxtaposition}} @@ -35,9 +37,9 @@ void f(std::ostream& s1) s1 << "foo" << OUString(FOO); // expected-error@-1 {{replace '<<' between string literals with juxtaposition}} s1 << "foo" << OUString(foo); - s1 << "foo" << OUStringLiteral("foo"); //TODO: warn too, OUStringLiteral wrapped in OUString - s1 << "foo" << OUStringLiteral(FOO); //TODO: warn too, OUStringLiteral wrapped in OUString - s1 << "foo" << OUStringLiteral(foo); + s1 << "foo" << OUStringLiteral(u"foo"); //TODO: warn too, OUStringLiteral wrapped in OUString + s1 << "foo" << OUStringLiteral(FOOu); //TODO: warn too, OUStringLiteral wrapped in OUString + s1 << "foo" << OUStringLiteral(foou); OString s2; s2 = "foo" + OString("foo"); // expected-error@-1 {{replace '+' between string literals with juxtaposition}} @@ -55,11 +57,11 @@ void f(std::ostream& s1) s3 = "foo" + OUString(FOO); // expected-error@-1 {{replace '+' between string literals with juxtaposition}} s3 = "foo" + OUString(foo); - s3 = "foo" + OUStringLiteral("foo"); + s3 = "foo" + OUStringLiteral(u"foo"); // expected-error@-1 {{replace '+' between string literals with juxtaposition}} - s3 = "foo" + OUStringLiteral(FOO); + s3 = "foo" + OUStringLiteral(FOOu); // expected-error@-1 {{replace '+' between string literals with juxtaposition}} - s3 = "foo" + OUStringLiteral(foo); + s3 = "foo" + OUStringLiteral(foou); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |