[PATCH] D139864: [llvm-cxxfilt] 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
Mon May 1 12:25:02 PDT 2023


DiggerLin added a comment.

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

> Given that the demangling code (not the llvm-cxxfilt code though) is used in various places in LLVM, it's important this dot behaviour goes in the right place. I assume therefore that the dot stripping behaviour belongs in LLVMDemangle, on the basis that I expect tools like llvm-objdump should be able to handle the dot too.



  I think it is difficult to implement the functionality in LLVMDemangle, for example, if I implement it in the function llvm::nonMicrosoftDemangle(const char *MangledName, std::string &Result)

it will cause the symbol name "_._Z3f.0v" to be demangled as ".f.0()"  in some place.

for example ,in the file Demangle.cpp

  std::string llvm::demangle(const std::string &MangledName) {
    std::string Result;
    const char *S = MangledName.c_str();
  
    if (nonMicrosoftDemangle(S, Result))
      return Result;
  
    if (S[0] == '_' && nonMicrosoftDemangle(S + 1, Result))
      return Result;
  ....
  }

but gnu c++filt demangle above as

[zhijian at krypton src]$ c++filt _._Z3f.0v
_._Z3f.0v


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