[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
Thu Sep 21 11:49:55 PDT 2023
DiggerLin marked an inline comment as done.
DiggerLin added a comment.
In D139864#4641608 <https://reviews.llvm.org/D139864#4641608>, @jhenderson wrote:
> My opinion hasn't changed that it's a mistake to put the dot demangling in llvm-cxxfilt specifically. That will mean you'll need to make the same change in llvm-nm, llvm-readelf, llvm-objdump and probably other tools too. Code duplication is bad. The next tool to be added might not realise that they can't just use the main demangler library as-is to do their name demangling.
>
> If there is tool code that conflicts with that behaviour (such as the llvm-nm mach-o code), perhaps it's that tool code that should change instead, or perhaps we need to enhance the demangler library a little further, for example by adding an optional "strip underscore" behaviour to it. Adding @MaskRay as a reviewer in case he's got a different opinion.
1. there is option `--strip-underscore` in the llvm-cxxfilt, it is difficult to use `std::string llvm::demangle(std::string_view MangledName)` for the llvm-cxxfilt , please see the https://reviews.llvm.org/D110664#inline-1063385
2. even I add a new parameter to function `std::string llvm::demangle(std::string_view MangledName)` as `std::string llvm::demangle(std::string_view MangledName,bool StripUnderscore=true)`
But the function std::string llvm::demangle() do the functionailty `microsoftDemangle(MangledName, nullptr, nullptr)` which do not need by the `static std::string demangle(const std::string &Mangled)` of llvm-cxxfile.cpp
3. in the `static std::string demangle(const std::string &Mangled)` of llvm-cxxfile.cpp ,if demangle do not success, it still to do
if nonMicrosoftDemangle not successful, it will continue to do
if (Types)
Undecorated = itaniumDemangle(DecoratedStr);
if (!Undecorated && starts_with(DecoratedStr, "__imp_")) {
Prefix = "import thunk for ";
Undecorated = itaniumDemangle(DecoratedStr.substr(6));
}
but std::string llvm::demangle(std::string_view MangledName) do not return a bool to indiccated demangle is successful or not
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