[PATCH] D103847: [Demangle][Rust] Parse type backreferences
Tomasz Miąsko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 8 01:03:29 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG44d63c57c129: [Demangle][Rust] Parse type backreferences (authored by tmiasko).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103847/new/
https://reviews.llvm.org/D103847
Files:
llvm/lib/Demangle/RustDemangle.cpp
llvm/test/Demangle/rust.test
Index: llvm/test/Demangle/rust.test
===================================================================
--- llvm/test/Demangle/rust.test
+++ llvm/test/Demangle/rust.test
@@ -425,6 +425,9 @@
CHECK: backref::<backref::ident>
_RIC7backrefNvB0_5identE
+CHECK: backref::<(), ()>
+ _RIC7backrefuB9_E
+
; Invalid backreferences
CHECK: _RB_
@@ -436,6 +439,9 @@
CHECK: _RNvB_1a
_RNvB_1a
+CHECK: _RIC7backrefSB9_E
+ _RIC7backrefSB9_E
+
; Invalid mangled characters
CHECK: _RNvC2a.1c
Index: llvm/lib/Demangle/RustDemangle.cpp
===================================================================
--- llvm/lib/Demangle/RustDemangle.cpp
+++ llvm/lib/Demangle/RustDemangle.cpp
@@ -438,8 +438,13 @@
// | "D" <dyn-bounds> <lifetime> // dyn Trait<Assoc = X> + Send + 'a
// | <backref> // backref
void Demangler::demangleType() {
- size_t Start = Position;
+ if (Error || RecursionLevel >= MaxRecursionLevel) {
+ Error = true;
+ return;
+ }
+ SwapAndRestore<size_t> SaveRecursionLevel(RecursionLevel, RecursionLevel + 1);
+ size_t Start = Position;
char C = consume();
BasicType Type;
if (parseBasicType(C, Type))
@@ -506,6 +511,9 @@
Error = true;
}
break;
+ case 'B':
+ demangleBackref([&] { demangleType(); });
+ break;
default:
Position = Start;
demanglePath(rust_demangle::InType::Yes);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103847.350523.patch
Type: text/x-patch
Size: 1411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210608/16ea17bc/attachment.bin>
More information about the llvm-commits
mailing list