diff options
Diffstat (limited to 'compilerplugins/clang/test')
-rw-r--r-- | compilerplugins/clang/test/conditionalstring.cxx | 11 | ||||
-rw-r--r-- | compilerplugins/clang/test/elidestringvar.cxx | 3 | ||||
-rw-r--r-- | compilerplugins/clang/test/staticvar.cxx | 6 | ||||
-rw-r--r-- | compilerplugins/clang/test/stringadd.cxx | 2 | ||||
-rw-r--r-- | compilerplugins/clang/test/stringconcatliterals.cxx | 5 |
5 files changed, 12 insertions, 15 deletions
diff --git a/compilerplugins/clang/test/conditionalstring.cxx b/compilerplugins/clang/test/conditionalstring.cxx index f38bc1d2436f..c044ee324b50 100644 --- a/compilerplugins/clang/test/conditionalstring.cxx +++ b/compilerplugins/clang/test/conditionalstring.cxx @@ -13,17 +13,14 @@ void f(OUString s, bool b) { - // expected-error@+2 {{replace 2nd operand of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}} + // expected-error@+2 {{replace 2nd operand of conditional expression with `std::u16string_view` [loplugin:conditionalstring]}} // expected-note@+1 {{conditional expression is here [loplugin:conditionalstring]}} 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(u"b")); - // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}} + // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `std::u16string_view` [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]}} + // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `std::u16string_view` [loplugin:conditionalstring]}} b = operator==(s, b ? OUString("x") : OUString("y")); - // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `rtl::OUStringLiteral` [loplugin:conditionalstring]}} + // expected-error@+1 {{replace both 2nd and 3rd operands of conditional expression with `std::u16string_view` [loplugin:conditionalstring]}} s.operator+=(b ? OUString("x") : OUString("y")); } diff --git a/compilerplugins/clang/test/elidestringvar.cxx b/compilerplugins/clang/test/elidestringvar.cxx index bc0de05c999e..1835c183bb39 100644 --- a/compilerplugins/clang/test/elidestringvar.cxx +++ b/compilerplugins/clang/test/elidestringvar.cxx @@ -18,8 +18,9 @@ OUString f(sal_Unicode c, int n) OUString s2('a'); // expected-note@+1 {{literal OUString variable defined here [loplugin:elidestringvar]}} OUString s3(u'a'); + static constexpr OUStringLiteral s4lit(u"a"); // expected-note@+1 {{literal OUString variable defined here [loplugin:elidestringvar]}} - OUString s4 = OUStringLiteral(u"a"); + OUString s4 = s4lit; switch (n) { case 1: diff --git a/compilerplugins/clang/test/staticvar.cxx b/compilerplugins/clang/test/staticvar.cxx index f527df6a521a..5c0a86fc420f 100644 --- a/compilerplugins/clang/test/staticvar.cxx +++ b/compilerplugins/clang/test/staticvar.cxx @@ -11,6 +11,8 @@ #include <sal/config.h> #include <rtl/ustring.hxx> +#include <string_view> + struct S1 { int x, y; @@ -52,13 +54,13 @@ S2 const& f3() // no warning expected struct S4 { - OUStringLiteral const cName; + std::u16string_view const cName; bool const bCanBeVisible; }; S4 const& f4() { static const S4 s1[] = { - { OUStringLiteral(u"/DocColor"), false }, + { std::u16string_view(u"/DocColor"), false }, }; return s1[0]; } diff --git a/compilerplugins/clang/test/stringadd.cxx b/compilerplugins/clang/test/stringadd.cxx index 0879805d3449..e17b207fcb64 100644 --- a/compilerplugins/clang/test/stringadd.cxx +++ b/compilerplugins/clang/test/stringadd.cxx @@ -18,7 +18,7 @@ namespace test1 { static const char XXX1[] = "xxx"; -static const char16_t XXX1u[] = u"xxx"; +static constexpr char16_t XXX1u[] = u"xxx"; static const char XXX2[] = "xxx"; void f1(OUString s1, int i, OString o) { diff --git a/compilerplugins/clang/test/stringconcatliterals.cxx b/compilerplugins/clang/test/stringconcatliterals.cxx index 348440f0ec4c..d19ebb97c1c3 100644 --- a/compilerplugins/clang/test/stringconcatliterals.cxx +++ b/compilerplugins/clang/test/stringconcatliterals.cxx @@ -20,7 +20,7 @@ void f(std::ostream& s1) { static constexpr char foo[] = "foo"; - static char16_t const foou[] = u"foo"; + static constexpr char16_t foou[] = u"foo"; s1 << "foo" << "foo"; // expected-error@-1 {{replace '<<' between string literals with juxtaposition}} @@ -37,9 +37,6 @@ 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(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}} |