Kaydet (Commit) f79123a8 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:stringconstant: Also handle u8"..." strings

(just in case)

Change-Id: Id8ce7436bacba874d9bc04915e42622e3cfca67a
üst 9444671f
......@@ -1163,7 +1163,7 @@ bool StringConstant::isStringConstant(
}
clang::StringLiteral const * lit = dyn_cast<clang::StringLiteral>(expr);
if (lit != nullptr) {
if (!lit->isAscii()) {
if (!(lit->isAscii() || lit->isUTF8())) {
return false;
}
unsigned n = lit->getLength();
......
......@@ -66,6 +66,8 @@ int main() {
(void) OUString("x\xA0x", 3, RTL_TEXTENCODING_ISO_8859_1);
(void) OUString("xxx", 2, RTL_TEXTENCODING_ASCII_US); // expected-error {{suspicious 'rtl::OUString' constructor with literal of length 3 and non-matching length argument 2 [loplugin:stringconstant]}}
(void) OUString(u8"xxx", 3, RTL_TEXTENCODING_ASCII_US); // expected-error {{simplify construction of 'OUString' with string constant argument [loplugin:stringconstant]}}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment