aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Demangle/RustDemangle.cpp
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-06-18 09:27:50 +0200
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-06-18 09:29:45 +0200
commit2a5bb9c877f23224ee6b789054b4edfa17b4fd30 (patch)
tree9b958fa2d44868a2d73695658a5fcc9b3d8ee840 /llvm/lib/Demangle/RustDemangle.cpp
parent6de741de08a11048027cb4d4e4d5d4bd067319fa (diff)
downloadllvm-2a5bb9c877f23224ee6b789054b4edfa17b4fd30.zip
llvm-2a5bb9c877f23224ee6b789054b4edfa17b4fd30.tar.gz
llvm-2a5bb9c877f23224ee6b789054b4edfa17b4fd30.tar.bz2
[Demangle][Rust] Parse dot suffix
Allow mangled names to include an arbitrary dot suffix, akin to vendor specific suffix in Itanium mangling. Primary motivation is a support for symbols renamed during ThinLTO import / promotion (ThinLTO is the default configuration for optimized builds in rustc). Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D104358
Diffstat (limited to 'llvm/lib/Demangle/RustDemangle.cpp')
-rw-r--r--llvm/lib/Demangle/RustDemangle.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp
index 919a668..39db8fd 100644
--- a/llvm/lib/Demangle/RustDemangle.cpp
+++ b/llvm/lib/Demangle/RustDemangle.cpp
@@ -109,7 +109,9 @@ bool Demangler::demangle(StringView Mangled) {
Error = true;
return false;
}
- Input = Mangled;
+ size_t Dot = Mangled.find('.');
+ Input = Mangled.substr(0, Dot);
+ StringView Suffix = Mangled.dropFront(Dot);
demanglePath(rust_demangle::InType::No);
@@ -121,6 +123,12 @@ bool Demangler::demangle(StringView Mangled) {
if (Position != Input.size())
Error = true;
+ if (!Suffix.empty()) {
+ print(" (");
+ print(Suffix);
+ print(")");
+ }
+
return !Error;
}