mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[Demangle][Rust] Parse bool constants
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D102518
This commit is contained in:
parent
d5b7e80f68
commit
903e2e109e
@ -80,6 +80,7 @@ private:
|
||||
void demangleType();
|
||||
void demangleConst();
|
||||
void demangleConstInt();
|
||||
void demangleConstBool();
|
||||
|
||||
Identifier parseIdentifier();
|
||||
uint64_t parseOptionalBase62Number(char Tag);
|
||||
|
@ -411,11 +411,14 @@ void Demangler::demangleConst() {
|
||||
case BasicType::USize:
|
||||
demangleConstInt();
|
||||
break;
|
||||
case BasicType::Bool:
|
||||
demangleConstBool();
|
||||
break;
|
||||
case BasicType::Placeholder:
|
||||
print('_');
|
||||
break;
|
||||
default:
|
||||
// FIXME demangle backreferences, bool constants, and char constants.
|
||||
// FIXME demangle backreferences and char constants.
|
||||
Error = true;
|
||||
break;
|
||||
}
|
||||
@ -439,6 +442,19 @@ void Demangler::demangleConstInt() {
|
||||
}
|
||||
}
|
||||
|
||||
// <const-data> = "0_" // false
|
||||
// | "1_" // true
|
||||
void Demangler::demangleConstBool() {
|
||||
StringView HexDigits;
|
||||
parseHexNumber(HexDigits);
|
||||
if (HexDigits == "0")
|
||||
print("false");
|
||||
else if (HexDigits == "1")
|
||||
print("true");
|
||||
else
|
||||
Error = true;
|
||||
}
|
||||
|
||||
// <undisambiguated-identifier> = ["u"] <decimal-number> ["_"] <bytes>
|
||||
Identifier Demangler::parseIdentifier() {
|
||||
bool Punycode = consumeIf('u');
|
||||
|
@ -191,6 +191,22 @@ CHECK: i64::<0>
|
||||
CHECK: u64::<0>
|
||||
_RIC3u64Ky0_E
|
||||
|
||||
; Bool constants
|
||||
|
||||
CHECK: bool::<false>
|
||||
_RIC4boolKb0_E
|
||||
|
||||
CHECK: bool::<true>
|
||||
_RIC4boolKb1_E
|
||||
|
||||
; Invalid bool constants
|
||||
|
||||
CHECK: _RIC4boolKb2_E
|
||||
_RIC4boolKb2_E
|
||||
|
||||
CHECK: _RIC4boolKbn0_E
|
||||
_RIC4boolKbn0_E
|
||||
|
||||
; Invalid mangled characters
|
||||
|
||||
CHECK: _RNvC2a.1c
|
||||
|
Loading…
Reference in New Issue
Block a user