File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ bool IsStringLiteralExpr(const clang::Expr *expr) {
259259
260260bool IsCodeUnitStringLiteral (const clang::StringLiteral *expr) {
261261 return expr->getCharByteWidth () != 1 ||
262- expr->getKind () == clang::StringLiteralKind:: UTF8 ;
262+ expr->getType ()-> getArrayElementTypeNoTypeQual ()-> isChar8Type () ;
263263}
264264
265265bool IsUserDefinedDecl (const clang::Decl *decl) {
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ int main() {
1919 printf (" %d %d\n " , lit[0 ], ulit[0 ]);
2020 printf (" %d\n " , is_negative (lit));
2121
22+ const char *u8s = u8" \u00e9 " ;
23+ printf (" %d %d\n " , u8s[0 ], u8s[1 ]);
24+
2225 const char *p = " \x80 " ;
2326 printf (" %d %d\n " , p[0 ], (unsigned char )p[0 ]);
2427
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ fn main_0() -> i32 {
3232 "{}" ,
3333 ( ( { is_negative_1( ( lit. as_pointer( ) as Ptr :: <i8 >) , ) } ) as i32 )
3434 ) ;
35+ let mut u8s: Ptr < i8 > = Ptr :: < i8 > :: from_string_literal ( b"\xc3 \xa9 " ) ;
36+ println ! (
37+ "{} {}" ,
38+ ( ( elem!( u8s, 0 ) . read( ) ) as i32 ) ,
39+ ( ( elem!( u8s, 1 ) . read( ) ) as i32 )
40+ ) ;
3541 let mut p: Ptr < i8 > = Ptr :: < i8 > :: from_string_literal ( b"\x80 " ) ;
3642 println ! (
3743 "{} {}" ,
Original file line number Diff line number Diff line change @@ -38,6 +38,12 @@ unsafe fn main_0() -> i32 {
3838 c"%d\n " . as_ptr ( ) as * const i8 ,
3939 ( ( unsafe { is_negative_1 ( ( lit. as_mut_ptr ( ) ) . cast_const ( ) ) } ) as i32 ) ,
4040 ) ;
41+ let mut u8s: * const libc:: c_char = c"\xc3 \xa9 " . as_ptr ( ) ;
42+ printf (
43+ c"%d %d\n " . as_ptr ( ) as * const i8 ,
44+ ( ( * u8s. offset ( ( 0 ) as isize ) ) as i32 ) ,
45+ ( ( * u8s. offset ( ( 1 ) as isize ) ) as i32 ) ,
46+ ) ;
4147 let mut p: * const libc:: c_char = c"\x80 " . as_ptr ( ) ;
4248 printf (
4349 c"%d %d\n " . as_ptr ( ) as * const i8 ,
You can’t perform that action at this time.
0 commit comments