[PATCH] D103151: [Demangle][Rust] Parse dyn-bounds
Tomasz Miąsko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 2 01:04:37 PDT 2021
tmiasko updated this revision to Diff 349188.
tmiasko marked 2 inline comments as done.
tmiasko added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103151/new/
https://reviews.llvm.org/D103151
Files:
llvm/include/llvm/Demangle/RustDemangle.h
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
@@ -232,6 +232,22 @@
CHECK: function::<unsafe extern "C-cmse-nonsecure-call" fn()>
_RIC8functionFUK21C_cmse_nonsecure_callEuE
+; Trait objects
+
+CHECK: trait::<dyn >
+ _RIC5traitDEL_E
+
+CHECK: trait::<dyn for<'a> >
+ _RIC5traitDG_EL_E
+
+CHECK: trait::<for<'a> fn(dyn for<'b> + 'a)>
+ _RIC5traitFG_DG_EL0_EuE
+
+; Invalid trait object, missing lifetime.
+
+CHECK: _RIC5traitDEE
+ _RIC5traitDEE
+
; Binders
CHECK: binders::<for<'a> fn(&'a _)>
Index: llvm/lib/Demangle/RustDemangle.cpp
===================================================================
--- llvm/lib/Demangle/RustDemangle.cpp
+++ llvm/lib/Demangle/RustDemangle.cpp
@@ -480,6 +480,17 @@
case 'F':
demangleFnSig();
break;
+ case 'D':
+ demangleDynBounds();
+ if (consumeIf('L')) {
+ if (auto Lifetime = parseBase62Number()) {
+ print(" + ");
+ printLifetime(Lifetime);
+ }
+ } else {
+ Error = true;
+ }
+ break;
default:
Position = Start;
demanglePath(rust_demangle::InType::Yes);
@@ -529,6 +540,16 @@
}
}
+// <dyn-bounds> = [<binder>] {<dyn-trait>} "E"
+void Demangler::demangleDynBounds() {
+ SwapAndRestore<size_t> SaveBoundLifetimes(BoundLifetimes, BoundLifetimes);
+ print("dyn ");
+ demangleOptionalBinder();
+ // FIXME demangle {dyn-trait}
+ if (!consumeIf('E'))
+ Error = true;
+}
+
// Demangles optional binder and updates the number of bound lifetimes.
//
// <binder> = "G" <base-62-number>
Index: llvm/include/llvm/Demangle/RustDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/RustDemangle.h
+++ llvm/include/llvm/Demangle/RustDemangle.h
@@ -89,6 +89,7 @@
void demangleGenericArg();
void demangleType();
void demangleFnSig();
+ void demangleDynBounds();
void demangleOptionalBinder();
void demangleConst();
void demangleConstInt();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103151.349188.patch
Type: text/x-patch
Size: 2086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210602/78ee7709/attachment.bin>
More information about the llvm-commits
mailing list