mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[Demangle][Rust] Parse path backreferences
Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D103459
This commit is contained in:
parent
fcb88533b1
commit
1dcdf007c2
@ -102,6 +102,21 @@ private:
|
||||
void demangleConstBool();
|
||||
void demangleConstChar();
|
||||
|
||||
template <typename Callable> void demangleBackref(Callable Demangler) {
|
||||
uint64_t Backref = parseBase62Number();
|
||||
if (Error || Backref >= Position) {
|
||||
Error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Print)
|
||||
return;
|
||||
|
||||
SwapAndRestore<size_t> SavePosition(Position, Position);
|
||||
Position = Backref;
|
||||
Demangler();
|
||||
}
|
||||
|
||||
Identifier parseIdentifier();
|
||||
uint64_t parseOptionalBase62Number(char Tag);
|
||||
uint64_t parseBase62Number();
|
||||
|
@ -232,8 +232,12 @@ bool Demangler::demanglePath(InType InType, LeaveOpen LeaveOpen) {
|
||||
print(">");
|
||||
break;
|
||||
}
|
||||
case 'B': {
|
||||
bool IsOpen = false;
|
||||
demangleBackref([&] { IsOpen = demanglePath(InType, LeaveOpen); });
|
||||
return IsOpen;
|
||||
}
|
||||
default:
|
||||
// FIXME parse remaining productions.
|
||||
Error = true;
|
||||
break;
|
||||
}
|
||||
|
@ -420,6 +420,22 @@ CHECK: char::<'\u{10ffff}'>
|
||||
CHECK: _RIC4charKc1234567_E
|
||||
_RIC4charKc1234567_E
|
||||
|
||||
; Backreferences
|
||||
|
||||
CHECK: backref::<backref::ident>
|
||||
_RIC7backrefNvB0_5identE
|
||||
|
||||
; Invalid backreferences
|
||||
|
||||
CHECK: _RB_
|
||||
_RB_
|
||||
|
||||
CHECK: _RB5_
|
||||
_RB5_
|
||||
|
||||
CHECK: _RNvB_1a
|
||||
_RNvB_1a
|
||||
|
||||
; Invalid mangled characters
|
||||
|
||||
CHECK: _RNvC2a.1c
|
||||
|
Loading…
Reference in New Issue
Block a user