[PATCH] D103361: [Demangle][Rust] Parse dyn-trait
Tomasz Miąsko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 7 09:25:43 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1499afa09ba2: [Demangle][Rust] Parse dyn-trait (authored by tmiasko).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103361/new/
https://reviews.llvm.org/D103361
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
@@ -243,6 +243,15 @@
CHECK: trait::<for<'a> fn(dyn for<'b> + 'a)>
_RIC5traitFG_DG_EL0_EuE
+CHECK: trait::<dyn Display>
+ _RIC5traitDC7DisplayEL_E
+
+CHECK: trait::<dyn Display + Send + Sync>
+ _RIC5traitDC7DisplayC4SendC4SyncEL_E
+
+CHECK: trait::<dyn for<'a> Display>
+ _RIC5traitDG_C7DisplayEL_E
+
; Invalid trait object, missing lifetime.
CHECK: _RIC5traitDEE
Index: llvm/lib/Demangle/RustDemangle.cpp
===================================================================
--- llvm/lib/Demangle/RustDemangle.cpp
+++ llvm/lib/Demangle/RustDemangle.cpp
@@ -545,9 +545,18 @@
SwapAndRestore<size_t> SaveBoundLifetimes(BoundLifetimes, BoundLifetimes);
print("dyn ");
demangleOptionalBinder();
- // FIXME demangle {dyn-trait}
- if (!consumeIf('E'))
- Error = true;
+ for (size_t I = 0; !Error && !consumeIf('E'); ++I) {
+ if (I > 0)
+ print(" + ");
+ demangleDynTrait();
+ }
+}
+
+// <dyn-trait> = <path> {<dyn-trait-assoc-binding>}
+// <dyn-trait-assoc-binding> = "p" <undisambiguated-identifier> <type>
+void Demangler::demangleDynTrait() {
+ demanglePath(InType::Yes);
+ // FIXME demangle {<dyn-trait-assoc-binding>}
}
// Demangles optional binder and updates the number of bound lifetimes.
Index: llvm/include/llvm/Demangle/RustDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/RustDemangle.h
+++ llvm/include/llvm/Demangle/RustDemangle.h
@@ -90,6 +90,7 @@
void demangleType();
void demangleFnSig();
void demangleDynBounds();
+ void demangleDynTrait();
void demangleOptionalBinder();
void demangleConst();
void demangleConstInt();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103361.350326.patch
Type: text/x-patch
Size: 1844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210607/61e08c71/attachment.bin>
More information about the llvm-commits
mailing list