sb.append(OString(s2));// expected-error {{in call of 'rtl::OStringBuffer::append', elide explicit 'OString' constructor, and turn the non-array string constant into an array [loplugin:stringconstant]}}
sb.append(OString(s2,std::strlen(s2)));// expected-error {{in call of 'rtl::OStringBuffer::append', elide explicit 'OString' constructor, and turn the non-array string constant into an array [loplugin:stringconstant]}}
sb.append("foo");
sb.append(s1);
sb.append(s2);// expected-error {{in call of 'rtl::OStringBuffer::append' with non-array string constant argument, turn the non-array string constant into an array [loplugin:stringconstant]}}
sb.append("foo",std::strlen("foo"));// expected-error {{rewrite call of 'rtl::OStringBuffer::append' with string constant and matching length arguments as call of 'rtl::OStringBuffer::append' [loplugin:stringconstant]}}
sb.append(s1,3/*std::strlen(s1)*/);// expected-error {{rewrite call of 'rtl::OStringBuffer::append' with string constant and matching length arguments as call of 'rtl::OStringBuffer::append' [loplugin:stringconstant]}}
sb.append(s2,3/*std::strlen(s2)*/);// expected-error {{rewrite call of 'rtl::OStringBuffer::append' with string constant and matching length arguments as call of 'rtl::OStringBuffer::append', and turn the non-array string constant into an array [loplugin:stringconstant]}}
sb.insert(0,OString(s2));// expected-error {{in call of 'rtl::OStringBuffer::insert', elide explicit 'OString' constructor, and turn the non-array string constant into an array [loplugin:stringconstant]}}
sb.insert(0,OString(s2,std::strlen(s2)));// expected-error {{in call of 'rtl::OStringBuffer::insert', elide explicit 'OString' constructor, and turn the non-array string constant into an array [loplugin:stringconstant]}}
sb.insert(0,"foo");
sb.insert(0,s1);
sb.insert(0,s2);// expected-error {{in call of 'rtl::OStringBuffer::insert' with non-array string constant argument, turn the non-array string constant into an array [loplugin:stringconstant]}}
sb.insert(0,"foo",std::strlen("foo"));// expected-error {{rewrite call of 'rtl::OStringBuffer::insert' with string constant and matching length arguments as call of 'rtl::OStringBuffer::insert' [loplugin:stringconstant]}}
sb.insert(0,s1,3/*std::strlen(s1)*/);// expected-error {{rewrite call of 'rtl::OStringBuffer::insert' with string constant and matching length arguments as call of 'rtl::OStringBuffer::insert' [loplugin:stringconstant]}}
sb.insert(0,s2,3/*std::strlen(s2)*/);// expected-error {{rewrite call of 'rtl::OStringBuffer::insert' with string constant and matching length arguments as call of 'rtl::OStringBuffer::insert', and turn the non-array string constant into an array [loplugin:stringconstant]}}
foo(OUString("xxx"));// expected-error {{in call of 'foo', replace 'OUString' constructed from a string literal directly with the string literal [loplugin:stringconstant}}
FooaFoo(OUString("xxx"),1);// expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
FooaFoo2(OUString("xxx"));// expected-error {{in call of 'Foo::Foo', replace 'OUString' constructed from a string literal directly with the string literal}}
aFoo2.foo(OUString("xxx"));// expected-error {{in call of 'Foo::foo', replace 'OUString' constructed from a string literal directly with the string literal}}
Foo2aFoo3(OString("xxx"));// expected-error {{in call of 'Foo2::Foo2', replace 'OUString' constructed from a string literal directly with the string literal}}
aFoo3.foo(OString("xxx"));// expected-error {{in call of 'Foo2::foo', replace 'OUString' constructed from a string literal directly with the string literal}}
(void)OUString("xxx",3,RTL_TEXTENCODING_ASCII_US);// expected-error {{simplify construction of 'OUString' with string constant argument [loplugin:stringconstant]}}
(void)OUString("xxx",3,RTL_TEXTENCODING_ISO_8859_1);// expected-error {{suspicious 'rtl::OUString' constructor with text encoding 12 but plain ASCII content; use 'RTL_TEXTENCODING_ASCII_US' instead [loplugin:stringconstant]}}
(void)OUString("\x80",1,RTL_TEXTENCODING_UTF8);// expected-error {{suspicious 'rtl::OUString' constructor with text encoding 'RTL_TEXTENCODING_UTF8' but non-UTF-8 content [loplugin:stringconstant]}}
(void)OUString("\xC2\x80",2,RTL_TEXTENCODING_UTF8);// expected-error {{simplify construction of 'OUString' with UTF-8 content as OUString(u"\u0080") [loplugin:stringconstant]}}
OUString().reverseCompareTo(OUString());// expected-error {{in call of 'rtl::OUString::reverseCompareTo', replace default-constructed 'OUString' with an empty string literal [loplugin:stringconstant]}}
ub.append("");// expected-error {{call of 'rtl::OUStringBuffer::append' with suspicious empty string constant argument [loplugin:stringconstant]}}
ub.append("foo\0bar");// expected-error {{call of 'rtl::OUStringBuffer::append' with string constant argument containing embedded NULLs [loplugin:stringconstant]}}
ub.append("foo\x80""bar");// expected-error {{call of 'rtl::OUStringBuffer::append' with string constant argument containing non-ASCII characters [loplugin:stringconstant]}}
charconstsc1[]="";
ub.append(sc1);// expected-error {{call of 'rtl::OUStringBuffer::append' with suspicious empty string constant argument [loplugin:stringconstant]}}
charconstsc2[]="foo\0bar";
ub.append(sc2);// expected-error {{call of 'rtl::OUStringBuffer::append' with string constant argument containing embedded NULLs [loplugin:stringconstant]}}
charconstsc3[]="foo\x80""bar";
ub.append(sc3);// expected-error {{call of 'rtl::OUStringBuffer::append' with string constant argument containing non-ASCII characters [loplugin:stringconstant]}}
charconstsc4[]={'f','o','o','b','a','r'};
ub.append(sc4);// expected-error {{call of 'rtl::OUStringBuffer::append' with string constant argument lacking a terminating NULL [loplugin:stringconstant]}}
ub.append(static_cast<charconst*>(sc1));
ub.append(static_cast<charconst*>(sc2));// at runtime: append "foo"
ub.append(static_cast<charconst*>(sc3));// at runtime: assert
ub.append(static_cast<charconst*>(sc4));// at runtime: UB
// expected-error-re@+1 {{in call of 'rtl::OString::getStr', replace default-constructed '{{(rtl::)?}}OString' directly with an empty ordinary string literal}}
OString().getStr();
// expected-error-re@+1 {{in call of 'rtl::OString::getStr', replace '{{(rtl::)?}}OString' constructed from a string literal directly with the string literal}}
OString("foo").getStr();
// expected-error-re@+1 {{in call of 'rtl::OString::getStr', replace '{{(rtl::)?}}OString' constructed from a string literal directly with the string literal}}
(OString(("foo"))).getStr();
// expected-error-re@+1 {{in call of 'rtl::OUString::getStr', replace default-constructed '{{(rtl::)?}}OUString' directly with an empty UTF-16 string literal}}
OUString().getStr();
// expected-error-re@+1 {{in call of 'rtl::OUString::getStr', replace '{{(rtl::)?}}OUString' constructed from a string literal directly with a UTF-16 string literal}}