diff --git a/llvm/lib/Demangle/RustDemangle.cpp b/llvm/lib/Demangle/RustDemangle.cpp --- a/llvm/lib/Demangle/RustDemangle.cpp +++ b/llvm/lib/Demangle/RustDemangle.cpp @@ -113,11 +113,20 @@ demanglePath(rust_demangle::InType::No); - if (Position != Input.size()) { + if (Position != Input.size() && look() != '.') { SwapAndRestore SavePrint(Print, false); demanglePath(InType::No); } + // An extension allowing an arbitrary dot suffix. + if (consumeIf('.')) { + auto Suffix = Input.substr(Position); + Position += Suffix.size(); + print(" ("); + print(Suffix); + print(")"); + } + if (Position != Input.size()) Error = true; diff --git a/llvm/test/Demangle/rust.test b/llvm/test/Demangle/rust.test --- a/llvm/test/Demangle/rust.test +++ b/llvm/test/Demangle/rust.test @@ -448,6 +448,14 @@ CHECK: _RIC7backrefKBa_E _RIC7backrefKBa_E +; Dot suffix + +CHECK: dot (llvm.1234) + _RC3dot.llvm.1234 + +CHECK: dot (llvm.6789) + _RC3dotC5crate.llvm.6789 + ; Invalid mangled characters CHECK: _RNvC2a.1c