[PATCH] D139864: [llvm-cxxfilt] Do not consider the prefix dot as part of the demangled symbol name.

Digger Lin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 06:47:24 PDT 2023


DiggerLin added a comment.

In D139864#4649934 <https://reviews.llvm.org/D139864#4649934>, @jhenderson wrote:

> Could you not just modify `nonMicrosoftDemangle` to handle the dot prefix? That would mean this works for all tools, including llvm-cxxfilt, rather than needing this and the separate D159539 <https://reviews.llvm.org/D159539> patch.

as I mention before, If I modify in `nonMicrosoftDemangle' as

  bool llvm::nonMicrosoftDemangle(const char *MangledName, std::string &Result) {
    char *Demangled = nullptr;
  
    // Not consider the prefix dot as part of the demangled symbol name.
    if (MangledName[0] == '.') {
      ++MangledName;
      Result = ".";
    }
  
    if (isItaniumEncoding(MangledName))
      Demangled = itaniumDemangle(MangledName, nullptr, nullptr, nullptr);
    else if (isRustEncoding(MangledName))
      Demangled = rustDemangle(MangledName);
    else if (isDLangEncoding(MangledName))
      Demangled = dlangDemangle(MangledName);
  
    if (!Demangled)
      return false;
  
    Result += Demangled;
    std::free(Demangled);
    return true;

The llvm-nm or llvm-cxxfilt for machO will demangle "_._Z3f.0v" as ".f.0()"
but
[zhijian at krypton src]$ /opt/at15.0/bin/c++filt _._Z3f.0v
_._Z3f.0v

>   I'm assuming that a dot prefix in front of a Microsoft mangled name doesn't make sense...

and  the `static std::string demangle(const std::string &Mangled)` do not invoke `microsoftDemangle`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139864



More information about the llvm-commits mailing list