1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[Demangle][Rust] Parse const backreferences

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D103848
This commit is contained in:
Tomasz Miąsko 2021-06-07 23:35:50 +02:00
parent 7b865d36b6
commit ea105e018d
2 changed files with 16 additions and 2 deletions

View File

@ -625,8 +625,15 @@ void Demangler::demangleOptionalBinder() {
// | "p" // placeholder
// | <backref>
void Demangler::demangleConst() {
if (Error || RecursionLevel >= MaxRecursionLevel) {
Error = true;
return;
}
SwapAndRestore<size_t> SaveRecursionLevel(RecursionLevel, RecursionLevel + 1);
char C = consume();
BasicType Type;
if (parseBasicType(consume(), Type)) {
if (parseBasicType(C, Type)) {
switch (Type) {
case BasicType::I8:
case BasicType::I16:
@ -652,10 +659,11 @@ void Demangler::demangleConst() {
print('_');
break;
default:
// FIXME demangle backreferences.
Error = true;
break;
}
} else if (C == 'B') {
demangleBackref([&] { demangleConst(); });
} else {
Error = true;
}

View File

@ -428,6 +428,9 @@ CHECK: backref::<backref::ident>
CHECK: backref::<(), ()>
_RIC7backrefuB9_E
CHECK: backref::<7, 7>
_RIC7backrefKi7_KBa_E
; Invalid backreferences
CHECK: _RB_
@ -442,6 +445,9 @@ CHECK: _RNvB_1a
CHECK: _RIC7backrefSB9_E
_RIC7backrefSB9_E
CHECK: _RIC7backrefKBa_E
_RIC7backrefKBa_E
; Invalid mangled characters
CHECK: _RNvC2a.1c