[PATCH] D103361: [Demangle][Rust] Parse dyn-trait
Tomasz Miąsko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 2 01:15:51 PDT 2021
tmiasko updated this revision to Diff 349191.
tmiasko retitled this revision from "[Rust][Demangle] Parse dyn-trait" to "[Demangle][Rust] Parse dyn-trait".
tmiasko added a comment.
Rebase
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.349191.patch
Type: text/x-patch
Size: 1844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210602/fc6513f6/attachment.bin>
More information about the llvm-commits
mailing list