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

Tomasz Miąsko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 17 11:33:07 PDT 2021


tmiasko added inline comments.


================
Comment at: llvm/lib/Demangle/RustDemangle.cpp:121-128
+  // An extension allowing an arbitrary dot suffix.
+  if (consumeIf('.')) {
+    auto Suffix = Input.substr(Position);
+    Position += Suffix.size();
+    print(" (");
+    print(Suffix);
+    print(")");
----------------
dblaikie wrote:
> Is this similar to the Itanium implementation? Or would it be possible/reasonable/simpler (maybe not, I don't know) to strip the '.' before doing any parsing at all? (or are there cases where the rust mangling can include '.' and so finding the trailing '.' must be a context-sensitive operation)
There is some variation in existing implementations. LLVM Itanium demangler prints `_Z1fv.llvm.1234` as `f() (.llvm.1234)`. The c++filt prints it as `f() [clone .llvm.1234]`. The rustc-demangle crate, which is used by rustc, omits `.llvm.*` suffixes from output, but prints others verbatim. The Rust demangler in c++filt rejects symbols with suffixes altogether.

The Rust mangling does not use `.` character by itself. So yes, suffix can be stripped ahead of time, which seems simpler than it was before.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104358



More information about the llvm-commits mailing list