[PATCH] D69592: [ELF] Suggest the extern "C" name as an alternative spelling
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 31 13:38:49 PDT 2019
thakis added a comment.
New diagnostic looks great.
================
Comment at: lld/ELF/Relocations.cpp:764
+ // suggesting the part before (.
+ std::string demangled = toString(sym);
+ auto paren = demangled.find('(');
----------------
MaskRay wrote:
> dblaikie wrote:
> > grimar wrote:
> > > I wonder if we might want to check `if (name.startswith("_Z"))` first. It might save a bit of calculations and isolate the logic a bit.
> > Rather than demangling and stringifying the whole name, then using a heuristic to find the function name - might it be better to use LLVM's demangling APIs to retrieve the name directly? llvm::itanium_demangle::Node::getBaseName
> Thanks for the suggestion. I'll just call `ItaniumPartialDemangler::getFunctionName`. We can check whether the node kind is `KNodeType` but such optimization may not be necessary.
Is "_Z" always correct? Blocks for example start with several underscores (3 maybe?). Do we need this check here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69592/new/
https://reviews.llvm.org/D69592
More information about the llvm-commits
mailing list