[PATCH] D69592: [ELF] Suggest the extern "C" name as an alternative spelling

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 14:43:41 PDT 2019


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lld/ELF/Relocations.cpp:764
+  // suggesting the part before (.
+  std::string demangled = toString(sym);
+  auto paren = demangled.find('(');
----------------
thakis wrote:
> 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?
I think very few if any people will complain if the blocks feature does not get a better diagnostic on an ELF platform, so we probably don't need to try one to four underscores.


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