loplugin:stringconstant: Also handle u8"..." strings
(just in case) Change-Id: Id8ce7436bacba874d9bc04915e42622e3cfca67a
This commit is contained in:
parent
9444671f1e
commit
f79123a823
@ -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]}}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user