[llvm] 1499afa - [Demangle][Rust] Parse dyn-trait
Tomasz Miąsko via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 7 09:25:28 PDT 2021
Author: Tomasz Miąsko
Date: 2021-06-07T18:18:31+02:00
New Revision: 1499afa09ba27ee0e6569668b74fea40e0458930
URL: https://github.com/llvm/llvm-project/commit/1499afa09ba27ee0e6569668b74fea40e0458930
DIFF: https://github.com/llvm/llvm-project/commit/1499afa09ba27ee0e6569668b74fea40e0458930.diff
LOG: [Demangle][Rust] Parse dyn-trait
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D103361
Added:
Modified:
llvm/include/llvm/Demangle/RustDemangle.h
llvm/lib/Demangle/RustDemangle.cpp
llvm/test/Demangle/rust.test
Removed:
################################################################################
diff --git a/llvm/include/llvm/Demangle/RustDemangle.h b/llvm/include/llvm/Demangle/RustDemangle.h
index 8158787b47ba..1302203f6f88 100644
--- a/llvm/include/llvm/Demangle/RustDemangle.h
+++ b/llvm/include/llvm/Demangle/RustDemangle.h
@@ -90,6 +90,7 @@ class Demangler {
void demangleType();
void demangleFnSig();
void demangleDynBounds();
+ void demangleDynTrait();
void demangleOptionalBinder();
void demangleConst();
void demangleConstInt();
diff --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp
index 04bc175c3b82..cbb52fa43b18 100644
--- a/llvm/lib/Demangle/RustDemangle.cpp
+++ b/llvm/lib/Demangle/RustDemangle.cpp
@@ -545,9 +545,18 @@ void Demangler::demangleDynBounds() {
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.
diff --git a/llvm/test/Demangle/rust.test b/llvm/test/Demangle/rust.test
index caded76e11be..59b41f68d511 100644
--- a/llvm/test/Demangle/rust.test
+++ b/llvm/test/Demangle/rust.test
@@ -243,6 +243,15 @@ CHECK: trait::<dyn for<'a> >
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
More information about the llvm-commits
mailing list