mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-07 08:34:59 +00:00
Fix the ASTPrinter output for ascii char literals >127.
Differential Revision: http://reviews.llvm.org/D17206 llvm-svn: 260795
This commit is contained in:
parent
22cc5e2375
commit
e43ae19b31
@ -1250,6 +1250,12 @@ void StmtPrinter::VisitCharacterLiteral(CharacterLiteral *Node) {
|
||||
OS << "'\\v'";
|
||||
break;
|
||||
default:
|
||||
// A character literal might be sign-extended, which
|
||||
// would result in an invalid \U escape sequence.
|
||||
// FIXME: multicharacter literals such as '\xFF\xFF\xFF\xFF'
|
||||
// are not correctly handled.
|
||||
if ((value & ~0xFFu) == ~0xFFu && Node->getKind() == CharacterLiteral::Ascii)
|
||||
value &= 0xFFu;
|
||||
if (value < 256 && isPrintable((unsigned char)value))
|
||||
OS << "'" << (char)value << "'";
|
||||
else if (value < 256)
|
||||
|
@ -13,6 +13,8 @@ void i() {
|
||||
h<u8'2'>();
|
||||
}
|
||||
|
||||
char j = '\xFF';
|
||||
|
||||
// CHECK: char c = u8'1';
|
||||
// CHECK-NEXT: char d = '1';
|
||||
// CHECK-NEXT: char e = U'1';
|
||||
@ -22,3 +24,4 @@ void i() {
|
||||
// CHECK: template <char c = u8'1'>
|
||||
|
||||
// CHECK: h<u8'2'>();
|
||||
// CHECK: char j = '\xff';
|
||||
|
Loading…
Reference in New Issue
Block a user