[PATCH] D104358: [Demangle][Rust] Parse dot suffix

Tomasz Miąsko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 18 00:31:14 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2a5bb9c877f2: [Demangle][Rust] Parse dot suffix (authored by tmiasko).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104358/new/

https://reviews.llvm.org/D104358

Files:
  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
@@ -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
Index: llvm/lib/Demangle/RustDemangle.cpp
===================================================================
--- llvm/lib/Demangle/RustDemangle.cpp
+++ llvm/lib/Demangle/RustDemangle.cpp
@@ -109,7 +109,9 @@
     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 @@
   if (Position != Input.size())
     Error = true;
 
+  if (!Suffix.empty()) {
+    print(" (");
+    print(Suffix);
+    print(")");
+  }
+
   return !Error;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104358.352925.patch
Type: text/x-patch
Size: 1047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210618/98794737/attachment.bin>


More information about the llvm-commits mailing list