aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Demangle/RustDemangle.cpp
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-05-15 23:24:16 +0200
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-05-15 23:52:25 +0200
commitf0f2a8b21cad8f291908ea411c7b38b8c4c8ee42 (patch)
tree3594ababac9726d05bc8ee49d3292b98cefb5953 /llvm/lib/Demangle/RustDemangle.cpp
parent64ef29bc66aae98efe27553267f1d56a62ee1a4d (diff)
downloadllvm-f0f2a8b21cad8f291908ea411c7b38b8c4c8ee42.zip
llvm-f0f2a8b21cad8f291908ea411c7b38b8c4c8ee42.tar.gz
llvm-f0f2a8b21cad8f291908ea411c7b38b8c4c8ee42.tar.bz2
[Demangle][Rust] Parse inherent implementations
Part of https://reviews.llvm.org/D102549
Diffstat (limited to 'llvm/lib/Demangle/RustDemangle.cpp')
-rw-r--r--llvm/lib/Demangle/RustDemangle.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp
index ebccafc..223d815 100644
--- a/llvm/lib/Demangle/RustDemangle.cpp
+++ b/llvm/lib/Demangle/RustDemangle.cpp
@@ -101,6 +101,7 @@ static inline bool isValid(const char C) {
bool Demangler::demangle(StringView Mangled) {
Position = 0;
Error = false;
+ Print = true;
RecursionLevel = 0;
if (!Mangled.consumeFront("_R")) {
@@ -145,6 +146,13 @@ void Demangler::demanglePath() {
print(Ident.Name);
break;
}
+ case 'M': {
+ demangleImplPath();
+ print("<");
+ demangleType();
+ print(">");
+ break;
+ }
case 'N': {
char NS = consume();
if (!isLower(NS) && !isUpper(NS)) {
@@ -199,6 +207,14 @@ void Demangler::demanglePath() {
}
}
+// <impl-path> = [<disambiguator>] <path>
+// <disambiguator> = "s" <base-62-number>
+void Demangler::demangleImplPath() {
+ SwapAndRestore<bool> SavePrint(Print, false);
+ parseOptionalBase62Number('s');
+ demanglePath();
+}
+
// <generic-arg> = <lifetime>
// | <type>
// | "K" <const>